Hover text in surface plots seems to be not working

I’m trying to add hover text to a 3d surface plot. Got to do it in a scatter3d plot, but doing the same seems not to work with the surface plots. The same thing happens in the official docs , where the hover text looks different to what should be. Should I open a github issue or I’m doing something wrong?

Here’s the data and layout code for my plot:

Looks like your text array is 1D. It needs to be 2D to match each z entry.

In the doc’s example, a 2D array is input to text but plotly.py is coercing the 2D string input into the text attribute to a 1D array so I would say this is a bug.

@xoelop, I think you can open an issue for this in plotly.py

It is working now in the code I was using. If I make text=scores.Text (a DataFrame, it’s part of a multiindexed DataFrame) I get the error.

ValueError:
Invalid value of type ‘pandas.core.frame.DataFrame’ received for the ‘text’ property of surface

If I make text=scores.Text.values.flatten() it doesn’t work, as in the example I posted.

But if I make text=scores.Text.values, it works

Sleeping is a good debugger I guess :sweat_smile:

BTW, do you think the previous plot is clearer or the next one is?

image

Nice job, I think passing scores.Text.values works here because it creates a numpy array which is handled differently by the StringValidator.

I personally find the surface plot to be clearer so I’m happy you worked out the hovertext :slight_smile: