IHasColormap and automatic Colorbar tick placement (2)#1405
IHasColormap and automatic Colorbar tick placement (2)#1405
Conversation
|
I don't know if there's a reason we chose to clip the range instead of rescale it, and I think rescaling is probably a more useful (and more aesthetically pleasing) choice. |
It probably made more sense earlier in the project before we had the new colorbar tools. Knowing what we know now, rescaling to use the full colorbar range seems like the least astonishing behavior. If we wanted to use a narrow range of the colormap I'm guessing we could add configuration for that in the Either way, this plan sounds good! I'll put this work down today and give that a go tomorrow. This is the last issue I hope to resolve before pushing the next release to NuGet 🤞 Thanks again for all your input along the way! 🚀 |
Fixes problem where right-aligned multi-line strings appear left-justified
allows a portion of a colormap to be displayed in a colorbar
|
Entertaining an alternative approach, we could keep the original heatmap behavior now that the colorbar has an option to restrict its display to a range of its colormap. What do you think of this strategy? If you like it, this may be ready to merge. double[,] imageData = DataGen.SampleImageData();
var heatmap = plt.AddHeatmap(imageData);
heatmap.Update(imageData, min: 75, max: 125);
var cb = plt.AddColorbar(heatmap);
// configure the colorbar to only show a small range of the colormap
cb.MinColor = 75 / 255.0;
cb.MaxColor = 125 / 255.0;
// configure the colorbar to display inequality operators at the edges
cb.MaxIsClipped = true;
cb.MinIsClipped = true; |
I think this is the best option if we clip intensities, but I still think that stretching is the best overall. |
Sounds good! I'll work toward supporting that too 👍 Would you object to me removing the |
The intent of these objects was probably to allow heatmaps to be displayed over specific coordinates. CoordinatedHeatmap was created to fix the problem these fields were likely originally intended to solve. Re-implementing this may allow these two plot types to be collapsed into one.
I agree that there are better alternatives, but I would deprecate it rather than remove it to avoid breaking changes. |
The goal is to mimic functionality previously found in CoordinatedHeatmap
|
dang, I did it again 😅 I just picked this up after a few hours and didn't notice your response was <2 minutes old... hopefully you still approve 😬 I'll see if I can figure out how to make GitHub block merges if there are still open reviews |
All good, I had nothing to add at the time. But now that I've come back I noticed this: Link to workflow run: https://github.com/ScottPlot/ScottPlot/actions/runs/1378617487 I don't think it will cause any bugs because |



Hi @bclehmann, sorry again for messing-up the merge of #1403 before you were finished reviewing it 🙏😅
The comments you made in #1403 about the inequality tick labels have me a bit stuck... Can you clarify the intention for what setting the scale limits is supposed to do? I see it's only using a portion of the colormap to display the heatmap, but was the intent to do the opposite? (use the whole colormap to display a small range of heatmap values?) Maybe a use-case would help me get my head around this because I keep getting stuck on it.
I tried consulting old cookbooks and it looks like this behavior has been around for a long time... maybe limiting the scale just doesn't make sense if a colorbar is going to be shown? If this is the case I could just remove the colorbar from the cookbook recipes and call it a day.
For reference here's your original commit: bclehmann@c869c50#diff-458a1d86f745cd1b356fac59a162a25358ef2dd95789df1472b4af4bce5d7a50R178
Example
An alternative expectation of the behavior could be:
A. The heatmap would use the full color range stretched to display the value range 75 - 125
B. The colorbar min/max labels would be "≤75" and "≥125"
extends #1403 and resolves #1362