Orientation of y-axis in Heatmap
See original GitHub issueThe default orientation of the y-axis in the Heatmap graph is, at least to me, unexpected. The 0,0 coordinate of the plot is in the lower left corner. A heatmap is generally used to display a matrix, such as an image, however, and the 0,0 index into the matrix would be in the top left corner. An image is thus displayed flipped upside down. One can of course flip the z
array or provide the values for y
in reversed order, but this keeps the labelling of the axis and the display of y,x in the hover window unaffected. I like the way this is handled in matplotlib.pyplot.imshow
, which provides an origin
argument.
An additional argument for the Heatmap
graph to control the orientation of the y-axis would be nice.
Issue Analytics
- State:
- Created 8 years ago
- Comments:23 (7 by maintainers)
Top Results From Across the Web
Changing the rotation of tick labels in Seaborn heatmap
The problem I ran into was with using Heatmap through Seaborn, and FacetGrid. I could rotate the x-axis ticks, but not the y-axis...
Read more >Rotating axis labels in matplotlib and seaborn
Here we have the classic problem with categorical data: we need to display all the labels and because some of them are quite...
Read more >Heatmap Axis Labels Printing Vertically? - MATLAB Answers
The heatmap's X labels orientation is dynamically determined based on the number of labels and the axes width. In other words, if you...
Read more >AxisModel API in Angular HeatMap API component - Syncfusion
Checkout and learn about AxisModel API in Angular HeatMap API component of ... boolean. Enable Trim for heatmap yAxis ... The angle to...
Read more >Axis Orientation | Axes and Grids - AnyChart Documentation
chart.xAxis().orientation("top"); chart.yAxis ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Figured it out. Python example:
Thanks for the extra context @elena-pascal, I think I’m understanding.
A couple of points of context from the Plotly.py maintenance perspective:
"reversed"
is with respect to an origin at the bottom left, which stems from the fact that the underlying layout engine for Plotly.py supports the plotting of multiple traces of different types on the same plot e.g. aheatmap
and ascatter
, and I suspect thescatter
was implemented first.yaxis_autorange="reversed"
on all plots containing onlyheatmap
traces. This is actually what we do for plots containing onlyimage
traces. We made this choice basically because we agree with you! We were able to do this without triggering a “breaking change” when initially implementingimage
last fall because there was no pre-existing code relying on the other behaviour.yaxis_autorange="reversed"
is exactly what Plotly.js implicitly does under the hood for plots with onlyimage
traces and whatpx.imshow
explicitly does under the hood to implement its defaultorigin="upper"
option, which works both with single-channel heatmap/matrix-like data and with multi-channel image-like data.I guess the bottom-line good news is that we do in fact already have built-in functionality in Plotly to display matrix-like data the way you would expect, without forcing you to explicitly declare anything as
"reversed"
: if you usepx.imshow
and leave theorigin
setting alone. The bad news is that if you inspect the figure (i.e.print(fig)
), you will see a possibly-confusingautorange="reversed"
in the y-axis, and there’s no way we can change that without upsetting other people.