Title: Add more projection options to Mapbox map layers in Python · Issue #4189 · plotly/plotly.py · GitHub
Open Graph Title: Add more projection options to Mapbox map layers in Python · Issue #4189 · plotly/plotly.py
X Title: Add more projection options to Mapbox map layers in Python · Issue #4189 · plotly/plotly.py
Description: Hi, I would like to see projection support in Mapbox map layers like, px.scatter_mapbox, such as 'globe' projection (which will make a tile-based 3d globe map). I noticed that Plotly is integrated with Mapbox-gl, and the Mapbox-GL suppor...
Open Graph Description: Hi, I would like to see projection support in Mapbox map layers like, px.scatter_mapbox, such as 'globe' projection (which will make a tile-based 3d globe map). I noticed that Plotly is integrated ...
X Description: Hi, I would like to see projection support in Mapbox map layers like, px.scatter_mapbox, such as 'globe' projection (which will make a tile-based 3d globe map). I noticed that Plotly is int...
Opengraph URL: https://github.com/plotly/plotly.py/issues/4189
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add more projection options to Mapbox map layers in Python","articleBody":"Hi, I would like to see projection support in Mapbox map layers like, `px.scatter_mapbox`, such as 'globe' projection (which will make a tile-based 3d globe map). I noticed that [Plotly is integrated with Mapbox-gl](https://plotly.com/python/mapbox-layers/), and the [Mapbox-GL support different projections](https://docs.mapbox.com/mapbox-gl-js/guides/projections/), so it should be easy to have this option in Plotly. It looks like it's already supported in `scatter_geo` (see the [doc](https://plotly.com/python-api-reference/generated/plotly.express.scatter_geo.html))but not Mapbox layers.\r\n\r\nSee projections support in Mapbox-GL [here](https://docs.mapbox.com/mapbox-gl-js/guides/projections/). See what's looks like with projection here,\r\n\u003cimg width=\"681\" alt=\"image\" src=\"https://user-images.githubusercontent.com/5254627/236315193-3090e555-630b-4a50-89e0-806d0d93dca0.png\"\u003e\r\n\u003cimg width=\"682\" alt=\"image\" src=\"https://user-images.githubusercontent.com/5254627/236315273-e46555ff-4a7b-4f62-9c4d-17597e7fc26e.png\"\u003e\r\n\r\nThe code by the support the function should look like,\r\n\r\n```python\r\nimport pandas as pd\r\nus_cities = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv\")\r\n\r\nimport plotly.express as px\r\n\r\nfig = px.scatter_mapbox(us_cities, lat=\"lat\", lon=\"lon\", hover_name=\"City\", hover_data=[\"State\", \"Population\"],\r\n color_discrete_sequence=[\"fuchsia\"], zoom=3, height=300)\r\nfig.update_layout(\r\n mapbox_style=\"white-bg\",\r\n mapbox_layers=[\r\n {\r\n \"below\": 'traces',\r\n \"sourcetype\": \"raster\",\r\n \"sourceattribution\": \"United States Geological Survey\",\r\n \"source\": [\r\n \"https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}\"\r\n ]\r\n }\r\n ])\r\nfig.update_layout(margin={\"r\":0,\"t\":0,\"l\":0,\"b\":0}, projection= 'globe')\r\nfig.show()\r\n```\r\nthe `projection` option can be configured to support more projections\r\n ","author":{"url":"https://github.com/wybert","@type":"Person","name":"wybert"},"datePublished":"2023-05-04T20:04:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4189/plotly.py/issues/4189"}
| 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:fc1af493-eae1-34f6-f499-f09ca3972a11 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2A0:2DA63D:1485BBF:1BB5E6D:6A595AD7 |
| html-safe-nonce | 7527383fccf1bc93c91154a051ac713f16f3eb9e46ed28e7fdf85bb71daeaf94 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkEwOjJEQTYzRDoxNDg1QkJGOjFCQjVFNkQ6NkE1OTVBRDciLCJ2aXNpdG9yX2lkIjoiODAwOTYzNzA5NTY1NTY5MzAxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f2003460de9a8e7f13c19baf4c49cc80c9994d9fde8abd2575c607af996259bf |
| hovercard-subject-tag | issue:1696621984 |
| 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.py/4189/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0bee34b79b394c1248f82b18e35ab09303c05dbed283acee874d433b3a19f384/plotly/plotly.py/issues/4189 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0bee34b79b394c1248f82b18e35ab09303c05dbed283acee874d433b3a19f384/plotly/plotly.py/issues/4189 |
| og:image:alt | Hi, I would like to see projection support in Mapbox map layers like, px.scatter_mapbox, such as 'globe' projection (which will make a tile-based 3d globe map). I noticed that Plotly is integrated ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wybert |
| hostname | github.com |
| expected-hostname | github.com |
| None | a540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5 |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 14579099 |
| octolytics-dimension-repository_nwo | plotly/plotly.py |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14579099 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.py |
| 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 | f4669eb12cd81bf213b8907a42667725d1583c79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width