Title: [BUG]: fitbounds="locations" thinks the world is flat and goes through longitude zero when dealing with positive and negative longitudes · Issue #7844 · plotly/plotly.js · GitHub
Open Graph Title: [BUG]: fitbounds="locations" thinks the world is flat and goes through longitude zero when dealing with positive and negative longitudes · Issue #7844 · plotly/plotly.js
X Title: [BUG]: fitbounds="locations" thinks the world is flat and goes through longitude zero when dealing with positive and negative longitudes · Issue #7844 · plotly/plotly.js
Description: 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 lo...
Open Graph Description: 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 zer...
X Description: 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 longi...
Opengraph URL: https://github.com/plotly/plotly.js/issues/7844
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: fitbounds=\"locations\" thinks the world is flat and goes through longitude zero when dealing with positive and negative longitudes","articleBody":"### Description\n\nThe Scatter_geo [fitbounds='locations' parameter](https://plotly.com/python-api-reference/generated/plotly.express.scatter_geo.html#:~:text=fitbounds%20(str%20(default%20False).)%20%E2%80%93%20One%20of%20False%2C%20locations%20or%20geojson.) 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.\n\nSpecifying longitude and latitude ranges manually is a workaround.\n\nLet me know if this would be a good PR for someone new to the codebase\n\n### Screenshots/Video\n\n\u003cimg width=\"1046\" height=\"667\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f86a2c7c-7574-4ae9-94b5-599ec6d00f4e\" />\n\n\u003cimg width=\"1037\" height=\"607\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/32fcf1f2-d1bf-435f-a62b-cd6764ddbef7\" />\n\n### Steps to reproduce\n\nRun this code\n```\nimport plotly.graph_objects as go\nfor lon in [-179, 179]:\n # Coordinates for the points\n lats = [43.1155, 32.7157]\n lons = [131.8855, lon]\n\n fig = go.Figure(go.Scattergeo(\n lat=lats,\n lon=lons,\n mode='markers+text',\n textposition='top center',\n marker=dict(size=10, color='red')\n ))\n\n fig.update_layout(\n title=f'eastern most longitude is {lon}',\n geo=dict(\n fitbounds=\"locations\",\n visible=True,\n projection_type='equirectangular'\n\n )\n )\n\n fig.show()\n```","author":{"url":"https://github.com/rl-utility-man","@type":"Person","name":"rl-utility-man"},"datePublished":"2026-03-16T14:33:11Z","url":"https://github.com/plotly/plotly.js/issues/7844"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c16b458-1f39-1eb8-32ef-19bb6eb5598d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96D2:2A7C1C:D16844:114DC02:6B01CAB8 |
| html-safe-nonce | 9046a336b739f2c06565d53f11d1e097fc9517062b3117490b55e1e5e299b004 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkQyOjJBN0MxQzpEMTY4NDQ6MTE0REMwMjo2QjAxQ0FCOCIsInZpc2l0b3JfaWQiOiI3ODczOTI1NDk4MDc1ODIwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a8a66be6552d92f5abb1bba025f9f1ec270f99c25bbc9e35c0f7400843c0d315 |
| hovercard-subject-tag | issue:4677322315 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.js/7844/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f10058c6976f29f1e8a3470784c072cc029d1f5dcbce80528f22a002fe0ff4b/plotly/plotly.js/issues/7844 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f10058c6976f29f1e8a3470784c072cc029d1f5dcbce80528f22a002fe0ff4b/plotly/plotly.js/issues/7844 |
| og:image:alt | 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 zer... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rl-utility-man |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width