Geographic point maps
Plot locations such as airports, cities, or other coordinate-based entities on an outline map.
Plotly · Class
go.Scattergeo is Plotly’s geographic scatter/line trace for plotting markers and paths from longitude and latitude coordinates. Its map background is controlled through the figure’s layout.geo configuration.
go.Scattergeo is a graph-object trace for plotting geographic points or paths. Supply longitude and latitude arrays, choose a display mode such as markers or lines, and configure the associated layout.geo object through figure layout or geographic update methods.
go.Scattergeo(arg=None, **kwargs)go.layout.Geo object controls the base map’s appearance.import plotly.graph_objects as go
fig = go.Figure(go.Scattergeo(
lon=[-74.006, -0.128, 2.352],
lat=[40.7128, 51.5072, 48.8566],
text=["New York", "London", "Paris"],
mode="markers",
marker={"size": 10, "color": "crimson"},
))
fig.update_layout(geo_scope="world")
fig.show()Creates a geographic marker trace and displays it on a world outline map.
Plot locations such as airports, cities, or other coordinate-based entities on an outline map.
Connect ordered coordinates to visualize routes or other geographic paths.
Represent a region with a closed geographic trace and an interior fill.
go.Scattergeo used for?go.Scattergeo is a geographic scatter/line trace. It represents locations with longitude and latitude and can render markers, lines, or both depending on its mode.
Follow-up: How is the map background configured? Use the figure’s layout.geo object, for example through update_layout or update_geos.
Set lon and lat with corresponding geographic coordinates, then choose mode="markers" for points or mode="lines" for paths. Optional text and marker properties control labeling and appearance.
Follow-up: How would you draw a filled region? Use a closed coordinate sequence and set the scatter trace’s fill attribute to "toself".
A Scattergeo trace uses an outline-based geographic subplot, whose visual configuration is held by layout.geo. Geographic scope and projection settings can be applied there rather than on the trace itself.
Follow-up: What changed for initial geographic framing in the current major version? Geo subplots now default fitbounds to "locations", fitting the initial view to plotted locations.
go.layout.Geopx.scatter_geopx.line_geogo.Choropleth