-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plotter: Is current "uniformness" of heatmap coloring intentional? #777
Comments
End points of a line are special, as are all boundary conditions. This is further complicated by the fact that we're calculating a value for the midpoint of a box (this is where the 0.5 comes from). But all things considered, this is aesthetics, if you don't like how it is and you think that a different approach should be used, please demonstrate the alternative graphically (preferably with something that is closer to continuous than only four colours). |
Probably I understand. You mean midpoint of a box is uniformly distributed, right?
What I expected is each color occupy same range. |
Oops I was confused somewhat. In the example, data range is [1, 12], not [0, 12]. So my explanation is not valid. Anyway, my intuition is, each color occupies same size of range. |
The ascii art you have is correct. But really, as I said, it's an aesthetic decision. If you think you have a better implementation, please show it and we can consider making the change. As it is, the intention is that gradation should be finer and the boundary behaviour diminishes to zero, ... and heat maps aren't really intended to show quantitative data in a way that is sensitive to this kind of issue. |
I edited the description with implementation I consider.
I'm not eager to change the behaviour nor add new option. In this issue, I mainly just wanted to get sure it is intentional to you (of course, wanted to "fix" if it's unintentional). Now I understand the current behaviour is intentional and it's an aesthetic decision. Honestly, I need "uniformly" distributed one for ranges, not for midpoint. However, we already have customized version of heat map in our repository with another reason so I'll just add this behaviour into our customized version. This issue can be closed, or we can keep this opened so that someone who need another behaviour can discuss. |
What are you trying to do?
Drawing heatmap.
What did you do?
What did you expect to happen?
Each color is used "uniformly". I consider 3 cells for each colors (3 * 4 = 12) is "unform".
Following code comments says palette is scaled uniformly across the data range.
plot/plotter/heat.go
Line 157 in b4fdc26
What actually happened?
2 cells for red, 4 cells for green, 4 cells for blue, 2 cells for yellow. This doesn't look uniform to me.
Probably first color and last color have half chance to be used compared the other colors.
In my thought, following should be
ps := float64(len(pal)) / (h.Max - h.Min)
plot/plotter/heat.go
Lines 157 to 158 in b4fdc26
and following shouldbe
col = pal[int((v-h.Min)*ps)]
to get uniform.plot/plotter/heat.go
Lines 222 to 224 in b4fdc26
What version of Go and Gonum/plot are you using?
Does this issue reproduce with the current master?
Not experimented yet. Maybe yes.
The text was updated successfully, but these errors were encountered: