How to configure hover in order to show only the hover_title?

Hi,

I have implemented a scatterplot in Django using Plotply express and I would like the hover to show only the title, not the coordinates.
Is it possible to do so? I have been playing around with it but with no success so far.

Hey @DeadBrain welcome to the forums.

There is actually an example in the documentation. You just have to define the hover_data dict and set to False whatever you would not like to be displayed.

An example:

import plotly.express as px

df_2007 = px.data.gapminder().query("year==2007")

fig = px.scatter(
    df_2007, 
    x="gdpPercap", 
    y="lifeExp", 
    log_x=True,
    hover_name="country", 
    hover_data={
        "gdpPercap": False, 
        "lifeExp": False
    }
)

fig.show()

Thanks a lot.
I had used that option from the documentation but it didn’t work.

I have just realized that the problem wasn’t in Plotply but in some variables I was passing to it from a Django form. Fixed that plotply is now doing the expected.

1 Like