Skip to content

Open map figures on the data, not on the whole world #106

Open

Description

@jvdd

Context

Every map figure (geo_histogram2d, geo_line) opens on the whole world, centered on lat 0 and lon 0 at zoom 1. The data can be anywhere. The user must pan and zoom to find it, for example to Belgium for data around Brussels.

Cause

This is not a Plotly default. PlotlyAdapter sets the view for every figure with a geo trace (flexviz/adapters/plotly_adapter.py:399-403):

layout_obj["map"] = {
    "style": "open-street-map",
    "center": {"lat": 0, "lon": 0},
    "zoom": 1,
}

The plotly.js 4.1.1 upgrade (#105) does not change this. Plotly 4 can fit a map to its data (plotly.js #7884), but only when the layout sets no center and zoom.

Constraints

  • The first map relayout writes "{figure_uid}/coordinates" into the viewport. geo_histogram2d bins the visible area, so the start view decides the first grid.
  • A shared or imported spec with a stored map viewport must keep its view.
  • Reset must go back to the start view.

Options to evaluate

  1. The client fits the map to the first delta. A geo_histogram2d delta already has lat_edges and lon_edges, and a geo_line delta has its points. To check: does the first grid cover the data bounds?
  2. Remove the fixed center and zoom, and let Plotly 4 fit the map. To check: what the fit does with an empty trace, and with a stored viewport.

Activity

  1. added
    enhancement
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions