Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Suppress default hover_data #120

Closed
alecfwilson opened this issue Jul 18, 2019 · 5 comments
Closed

Suppress default hover_data #120

alecfwilson opened this issue Jul 18, 2019 · 5 comments

Comments

@alecfwilson
Copy link

Is there any way to suppress the default hover_data when the hover_data argument is passed? For example, my plot doesn't need the x, y, and color args in the hover_data, but I can't figure out how to remove them.

@nicolaskruchten
Copy link
Contributor

At the moment there's no way to do this from the arguments, but this is something I'll look into. You can modify the hoverlabel contents fairly easily by modifying the hovertemplate attribute of the traces.

@nicolaskruchten
Copy link
Contributor

Right now the default value of hover_data is None, and it accepts an array of columns to add to the existing set of key-value pairs listed (which currently include every value mapped to some visual attribute in the chart). In terms of API, I could imagine either adding a new kwarg hover_data_exclusion or having hover_data accept a dict which would control if/how values are displayed. Someone recently suggested the idea of this kind of API to control the precision/formatting of numbers in hover labels with e.g. hover_data={"column": "format"} and this would fit in pretty nicely as hover_data={"column": False}

@nicolaskruchten
Copy link
Contributor

Will be completed in plotly/plotly.py#1774

@secsilm
Copy link

secsilm commented Feb 24, 2020

At the moment there's no way to do this from the arguments, but this is something I'll look into. You can modify the hoverlabel contents fairly easily by modifying the hovertemplate attribute of the traces.

For px.choropleth_mapbox, there is no hovertemplate parameter, right? I hope to do custom formatting like in go.Choroplethmapbox.

And I found that px.choropleth_mapbox has a template parameter, but I can't find any doc about it. Is there something I missed? Thanks.

@gpavanb-osi
Copy link

I have the same issue with px.scatter_mapbox as well. Currently, lat, lon and color are also being included in the hover text and there is no corresponding hovertemplate.

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

No branches or pull requests

4 participants