JuliaPlots / JuliaPlots/PlotlyJS.jl

Heatmap with customdata and hovertemplate doesn't display the right info, when size(customdata)=size(z)

Open
#462 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Example of heatmap defined such that to display on hover, both the corresponding z-value and a string pointing out,
let us say, the data class or category:
```
using PlotlyJS
customdata = string.(reshape('A':'L', 4, 3))
4×3 Matrix{String}:
"A" "E" "I"
"B" "F" "J"
"C" "G" "K"
"D" "H" "L"
#with this definition we get right data displayed on hover:
pl=plot(heatmap(z = [ 9 11 12 7;
12 8 13 2;
10 13 12 5],
customdata=customdata, #note that size(customdata)=size(z')
hovertemplate="z: %{z}
Class: %{customdata[0]}"))
```
But if we pass as `customdata` the transposed matrix of the initial one, as one would expect to be normal, i.e. z and customdata have the same size, on hover we get unparsed information:
```
restyle!(pl, customdata=permutedims(customdata))
```
The same bug should be fixed for the `contour` trace, and for
`surface`, when is plotting a surface defined as a graph of function, z=f(x,y), not a parametric surface, such as sphere. etc.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.