You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The heatmap plot type is useful for visualizing a matrix, but the cells are all transposed relative to how matrices are represented at the REPL. Additionally it is flipped so that index (1, 1) is at the bottom-left.
For Example:
plot(heatmap(z=reshape(1:12, 3, 4)))
Shows this:
The plotly.js docs don't seem to specify whether they expect row-major or column-major 2D arrays, but empirically they treat them as row-major. JSON.jl renders 2D matrices as column-major. It's always a tough call to decide when it's worth adding extra processing between PlotlyJS.jl and plotly.js, but in this case the behavior seems to be something of an implementation detail that it would be OK to change.
I'm a little more torn on the origin location (bottom-left vs. top-left) as that's a user-visible change that would make it behave differently than plotly.js.
The text was updated successfully, but these errors were encountered:
I think it probably makes sense to transpose the z matrix for the heat map. That being said, I don't know that PlotlyJS currently has the machinery in place to do this. We'll have to think about what point between creating a trace and displaying a plot is the right place for this type of logic.
I don't think we should try to change the location of the origin.
You'll need to add 'yflip=true' to also put the origin in the upper-left
corner (not the most common use of heatmap for most people).
On Wednesday, October 5, 2016, Spencer Lyon [email protected]
wrote:
Thanks for opening this.
I think it probably makes sense to transpose the z matrix for the heat
map. That being said, I don't know that PlotlyJS currently has the
machinery in place to do this. We'll have to think about what point between
creating a trace and displaying a plot is the right place for this type of
logic.
I don't think we should try to change the location of the origin.
The
heatmap
plot type is useful for visualizing a matrix, but the cells are all transposed relative to how matrices are represented at the REPL. Additionally it is flipped so that index (1, 1) is at the bottom-left.For Example:
Shows this:
The plotly.js docs don't seem to specify whether they expect row-major or column-major 2D arrays, but empirically they treat them as row-major. JSON.jl renders 2D matrices as column-major. It's always a tough call to decide when it's worth adding extra processing between PlotlyJS.jl and plotly.js, but in this case the behavior seems to be something of an implementation detail that it would be OK to change.
I'm a little more torn on the origin location (bottom-left vs. top-left) as that's a user-visible change that would make it behave differently than plotly.js.
The text was updated successfully, but these errors were encountered: