plotly / plotly/plotly.py

plotly.express.scatter_geo shows values provided to text argument in the hoverinfo instead of printing them on the map

Open
#2,575 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

I am trying to label some of the points on my scatter map using plotly.express.scatter_geo and text argument. I think there's a bug that causes text to be picked up for hoverinfo instead of the labels. See the reproducible example below:

import plotly.express as px

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

fig = px.scatter_geo(df, locations="iso_alpha",
                     color="continent", # which column to use to set the color of markers
                     hover_name="country", # column added to hover information
                     size="pop", # size of markers
                     projection="natural earth",
                     text="lifeExp")
fig.show()

image

I was expecting the values as labels for each point in reference to documentation: https://plotly.com/python-api-reference/generated/plotly.express.scatter_geo.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducible Python example using plotly.express.scatter_geo and compare the documented text argument with the generated map and hover behavior. Trace the scatter_geo entry point to determine why text is sent to hoverinfo instead of rendered as point labels. Done means the supplied values appear as labels on the map while the existing hover information remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.