Skip to content
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

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

Open
empet opened this issue Feb 21, 2023 · 0 comments

Comments

@empet
Copy link

empet commented Feb 21, 2023

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}<br>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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant