add ability to hide missing data from hover tooltip
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
I have a dataframe column with some missing values which I want to include in hover_data. Is it possible to show the column in the hover tooltip only if there's value for the currently hovered point? The current default behavior is to show col_name=%{customdata[0]} for missing values. I think it would be better to show nothing at all.

import plotly.express as px
df = px.data.gapminder().query("continent=='Oceania'")
df["pop"] = None
fig = px.line(
df,
x="year",
y="lifeExp",
color="country",
hover_data=["pop"],
title="layout.hovermode='closest' (the default)",
)
fig.update_traces(mode="markers+lines")
fig.show()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided Python example with plotly.express.line and hover_data, then trace how missing values become hover tooltip text. Done means points with missing values no longer display the hover column, while populated values remain visible; add or update coverage for this behavior if the relevant test area is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100