Fix marker size to coordinate system

I’m plotting markers on a scatter map using scattergeo, and I’d like to fix my marker size to the plot coordinates.

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")
fig.show()

Currently, when I zoom into the plot created by the above code, the markers stay the same size on the screen. In my program, these markers represent physical distances, so I’d like them to enlarge as the user zooms (just like zooming into any regular image).

This question was asked just over four years ago, but somebody answered that this functionality wasn’t available yet. Is there any way to do this now?

5 Likes

+1

I’m using scatter as a network graph with text inside my node markers, which is great. But, now we’re taking that static view and implementing it in Dash, where varying screen size and zoom are causing a really negative impact to the UX when the markers stay fixed in pixels.

+1

Really need this feature.
One thing that could be a hook for a workaround would be if there’d be a signal emitted when anything (like zoom) on the modebar is clicked but I don’t know if this exists or is even technically possible.

You can do it in dash-leaflet (:

+1

Really need this feature

I’ve resorted to creating circle lines and filling them.