Description
The Scatter_geo fitbounds='locations' parameter is supposed to show just the relevant part of the world. When the points are on both sides of longitude +/-180, it includes longitude zero on the map even if a map that shows longitude 180 would be far more compact. The two maps below are trivially different; when the eastern most coordinate is 179, the map is compact and fitbounds works as expected. When the eastern most coordinate is -179, the map includes a large amount of unnecessary, blank geography.
Specifying longitude and latitude ranges manually is a workaround.
Let me know if this would be a good PR for someone new to the codebase
Screenshots/Video
Steps to reproduce
Run this code
import plotly.graph_objects as go
for lon in [-179, 179]:
# Coordinates for the points
lats = [43.1155, 32.7157]
lons = [131.8855, lon]
fig = go.Figure(go.Scattergeo(
lat=lats,
lon=lons,
mode='markers+text',
textposition='top center',
marker=dict(size=10, color='red')
))
fig.update_layout(
title=f'eastern most longitude is {lon}',
geo=dict(
fitbounds="locations",
visible=True,
projection_type='equirectangular'
)
)
fig.show()