Black Lives Matter. Please consider donating to Black Girls Code today.

Automatically center a map to a region?

Hi,
Brand new to plotly and trying to show some data on a map. It seems the scopes for the maps are large (world, usa, e.t.c) I know the maps are interactive but I was wondering if you could automatically zoom or center a map to a specific region. Seems you can do so if you use mapbox? But not otherwise? is there an example somewhere?
As an aside, there is no search feature for the documentation, which would be very nice to have.
Thanks in advance.

Hi,

have you figured that out? I also would like to know if there’s a method in plotly to determine the ‘optimal’ center and ‘optimal’ zoom level for a given set of data points on a map.

Cheers
Konstantin

HI,

I ended up using MapBox:

layout = Layout(autosize=True, hovermode='closest' ,title="my map,        mapbox= dict(bearing=0,  pitch=0, zoom=10,            center=dict(lat=xx,                        lon=yy)),    )
  fig = dict(data=Data([Scattermapbox..]), layout)  map_url = pty.plot( fig, ..)

I don’t know if there’s a way to determine optimal zoom level. I had to do so manually.

Hope this helps.