✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

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?

2 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.