0
votes

How to display which columns value certain data point has when cursor is moved on to it. Which parameter to use for that?

For example, in the below graph, I am passing dataframe for scatter plot in as follows. As you can see, when I move cursor over one data point it shows me plotted x variable, y variable. What I want to do is to also display value from another column in dataframe value in that highlighted blue region to understand that data point better when cursor is moved on to that data point.

fig = px.scatter(data_frame=df,  x='var_Senken_Kraft', y='var_Senken_Planscheiber', color='labels')

enter image description here

1

1 Answers

1
votes

You could pass the parameter 'hover_data' as a list on the plot function to display more data:

fig = px.scatter(
        data_frame=df,
        x='var_Senken_Kraft',
        y='var_Senken_Planscheiber',
        color='labels',
        hover_data=[data_a, data_b]
)