From 50eb940a40861dffe37dc56061904edbd5c204bb Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 23 Jul 2026 11:38:03 -0400 Subject: [PATCH] remove mapbox references from docs and doc build workflow --- .github/workflows/build-doc.yml | 3 - .gitignore | 1 - doc/Makefile | 7 - doc/README.md | 13 -- doc/apidoc/plotly.express.rst | 5 - doc/apidoc/plotly.graph_objects.rst | 3 - doc/python/configuration-options.md | 4 +- doc/python/density-heatmaps.md | 51 +----- doc/python/figure-factories.md | 4 +- doc/python/filled-area-tile-maps.md | 31 +--- .../{hexbin-mapbox.md => hexbin-map.md} | 6 +- doc/python/lines-on-tile-maps.md | 44 +----- doc/python/map-configuration.md | 2 +- doc/python/migrate-to-maplibre.md | 2 +- doc/python/orca-management.md | 1 - doc/python/performance.md | 2 +- doc/python/shapes.md | 2 +- doc/python/static-image-export.md | 1 - .../static-image-generation-migration.md | 2 - doc/python/subplots.md | 2 +- doc/python/tile-county-choropleth.md | 37 +---- doc/python/tile-map-layers.md | 146 +++--------------- doc/python/tile-scatter-maps.md | 57 +------ doc/python/wide-form.md | 2 +- .../python/tesla-supercharging-stations.md | 13 +- 25 files changed, 44 insertions(+), 397 deletions(-) rename doc/python/{hexbin-mapbox.md => hexbin-map.md} (97%) diff --git a/.github/workflows/build-doc.yml b/.github/workflows/build-doc.yml index 072525166ba..094ee1f4531 100644 --- a/.github/workflows/build-doc.yml +++ b/.github/workflows/build-doc.yml @@ -38,12 +38,9 @@ jobs: - name: Build HTML docs - env: - MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} run: | cd doc source .venv/bin/activate - echo "${MAPBOX_TOKEN}" > python/.mapbox_token make -kj8 || make -kj8 curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py diff --git a/.gitignore b/.gitignore index 5bb4e110325..d266d02cd33 100644 --- a/.gitignore +++ b/.gitignore @@ -55,7 +55,6 @@ tests/test_core/test_offline/plotly.min.js temp-plot.html .vscode doc/python/.ipynb_checkpoints -doc/python/.mapbox_token doc/.ipynb_checkpoints tags doc/check-or-enforce-order.py diff --git a/doc/Makefile b/doc/Makefile index 9c4d0edab13..a0745490c39 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,13 +21,6 @@ all: $(HTML_FILES) $(V3_REDIR_FILES) $(NEXT_REDIR_FILES) .PRECIOUS: $(IPYNB_FILES) -$(IPYNB_DIR)/.mapbox_token: $(MD_DIR)/.mapbox_token - @mkdir -p $(IPYNB_DIR) - @echo "[symlink] .mapbox_token" - @cd $(IPYNB_DIR) && ln -s ../../$< - -$(IPYNB_FILES): $(IPYNB_DIR)/.mapbox_token - $(IPYNB_DIR)/%.ipynb: $(MD_DIR)/%.md @mkdir -p $(IPYNB_DIR) @echo "[jupytext] $<" diff --git a/doc/README.md b/doc/README.md index 4ccfaf4f658..b37168dd541 100644 --- a/doc/README.md +++ b/doc/README.md @@ -32,17 +32,6 @@ uv pip uninstall plotly # remove the PyPI version installed by requirement uv pip install -e .. # install from your local checkout ``` -### Mapbox token - -Several geographic examples require a free Mapbox public token. Without it, -those specific pages will fail to build. - -1. Create an account at https://account.mapbox.com/auth/signup -2. Navigate to https://account.mapbox.com/ and copy your "Default public token" -3. Save it to the file `doc/python/.mapbox_token` - -The Makefile symlinks this token into the build directory automatically. - ## Tutorials (`python` directory) Each tutorial is a markdown (`.md`) file, which can be opened in Jupyter @@ -391,8 +380,6 @@ Check `build/failures/` for the full error output. Common causes: - **Timeout** — the default is 600 seconds (10 minutes). If your example legitimately needs more time, discuss in an issue before increasing the timeout. -- **Missing Mapbox token** — geographic examples will fail if - `doc/python/.mapbox_token` does not exist. ### `make` fails immediately diff --git a/doc/apidoc/plotly.express.rst b/doc/apidoc/plotly.express.rst index c2512ee82d5..9a82acf4501 100644 --- a/doc/apidoc/plotly.express.rst +++ b/doc/apidoc/plotly.express.rst @@ -19,14 +19,12 @@ plotly's high-level API for rapid figure generation. :: scatter_polar scatter_ternary scatter_map - scatter_mapbox scatter_geo line line_3d line_polar line_ternary line_map - line_mapbox line_geo area bar @@ -48,13 +46,10 @@ plotly's high-level API for rapid figure generation. :: parallel_categories choropleth choropleth_map - choropleth_mapbox density_contour density_heatmap density_map - density_mapbox imshow - set_mapbox_access_token get_trendline_results diff --git a/doc/apidoc/plotly.graph_objects.rst b/doc/apidoc/plotly.graph_objects.rst index 46f246295a6..56442c843cc 100644 --- a/doc/apidoc/plotly.graph_objects.rst +++ b/doc/apidoc/plotly.graph_objects.rst @@ -101,9 +101,6 @@ Map Traces Scattermap Choroplethmap Densitymap - Scattermapbox - Choroplethmapbox - Densitymapbox Specialized Traces ----------- diff --git a/doc/python/configuration-options.md b/doc/python/configuration-options.md index b2ad530d1a5..537e247911f 100644 --- a/doc/python/configuration-options.md +++ b/doc/python/configuration-options.md @@ -212,7 +212,7 @@ To delete buttons from the modebar, pass an array of strings containing the name - **3D**: `zoom3d`, `pan3d`, `orbitRotation`, `tableRotation`, `handleDrag3d`, `resetCameraDefault3d`, `resetCameraLastSave3d`, `hoverClosest3d` - **Cartesian**: `hoverClosestCartesian`, `hoverCompareCartesian` - **Geo**: `zoomInGeo`, `zoomOutGeo`, `resetGeo`, `hoverClosestGeo` - - **Other**: `hoverClosestGl2d`, `hoverClosestPie`, `toggleHover`, `resetViews`, `toImage`, `sendDataToCloud`, `toggleSpikelines`, `resetViewMapbox` + - **Other**: `hoverClosestGl2d`, `hoverClosestPie`, `toggleHover`, `resetViews`, `toImage`, `sendDataToCloud`, `toggleSpikelines`, `resetViewMap` ```python import plotly.graph_objects as go @@ -305,7 +305,7 @@ fig.show() ### Double-Click Delay Sets the maximum delay between two consecutive clicks to be interpreted as a double-click in milliseconds. This is the time interval between first mousedown and second mouseup. The default timing is 300 ms (less than half a second). -This setting propagates to all on-subplot double clicks (except for `geo` and `mapbox`). +This setting propagates to all on-subplot double clicks (except for `geo` and `map`). ```python import plotly.graph_objects as go diff --git a/doc/python/density-heatmaps.md b/doc/python/density-heatmaps.md index e694c699437..7e1a316173b 100644 --- a/doc/python/density-heatmaps.md +++ b/doc/python/density-heatmaps.md @@ -31,7 +31,7 @@ jupyter: page_type: u-guide permalink: python/density-heatmaps/ redirect_from: python/mapbox-density-heatmaps/ - thumbnail: thumbnail/mapbox-density.png + thumbnail: thumbnail/map-density.png --- ### Density map with `plotly.express` @@ -67,55 +67,8 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) fig.show() ``` - -### Mapbox Maps - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -The earlier examples using `px.density_map` and `go.Densitymap` use [Maplibre](https://maplibre.org/maplibre-gl-js/docs/) for rendering. These traces were introduced in Plotly.py 5.24. These trace types are now the recommended way to make tile-based density heatmaps. There are also traces that use [Mapbox](https://docs.mapbox.com): `density_mapbox` and `go.Densitymapbox`. - -To use these trace types, in some cases you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. - -Here's one of the earlier examples rewritten to use `px.density_mapbox`. - -```python -import pandas as pd -df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv') - -import plotly.express as px -fig = px.density_mapbox(df, lat='Latitude', lon='Longitude', z='Magnitude', radius=10, - center=dict(lat=0, lon=180), zoom=0, - mapbox_style="open-street-map") -fig.show() -``` - - - - -#### Stamen Terrain base map with Mapbox (Stadia Maps token needed): density heatmap with `plotly.express` - -Some base maps require a token. To use "stamen" base maps, you'll need a [Stadia Maps](https://www.stadiamaps.com) token, which you can provide to the `mapbox_accesstoken` parameter on `fig.update_layout`. Here, we have the token saved in a file called `.mapbox_token`, load it in to the variable `token`, and then pass it to `mapbox_accesstoken`. - -```python -import plotly.express as px -import pandas as pd - -token = open(".mapbox_token").read() # you will need your own token - -df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv') - -fig = px.density_mapbox(df, lat='Latitude', lon='Longitude', z='Magnitude', radius=10, - center=dict(lat=0, lon=180), zoom=0, - map_style="stamen-terrain") -fig.update_layout(mapbox_accesstoken=token) -fig.show() -``` - - - #### Reference -See [function reference for `px.(density_map)`](https://plotly.com/python-api-reference/generated/plotly.express.density_mapbox) or https://plotly.com/python/reference/densitymap/ for available attribute options. +See [function reference for `px.(density_map)`](https://plotly.com/python-api-reference/generated/plotly.express.density_map) or https://plotly.com/python/reference/densitymap/ for available attribute options. -For Mapbox-based maps, see [function reference for `px.(density_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.density_mapbox) or https://plotly.com/python/reference/densitymapbox/. diff --git a/doc/python/figure-factories.md b/doc/python/figure-factories.md index 6c39f43acc7..b03086b632f 100644 --- a/doc/python/figure-factories.md +++ b/doc/python/figure-factories.md @@ -40,7 +40,7 @@ The `plotly.figure_factory` module contains dedicated functions for creating ver The following plot types can be created with Figure Factory: * [Dendrograms](/python/dendrogram/) - * [Hexagonal Binning Tile Map](/python/hexbin-mapbox/) + * [Hexagonal Binning Tile Map](/python/hexbin-map/) * [Quiver Plots](/python/quiver-plots/) * [Streamline Plots](/python/streamline-plots/) * [Tables](/python/figure-factory-table/) @@ -57,7 +57,7 @@ The following legacy Figure Factory functions have been replaced by Plotly Expre * `create_distplot`: use [Plotly Express](/python/plotly-express/) functions like [`px.histogram`](/python/histograms/) * `create_facet_grid`: use [Plotly Express](/python/plotly-express/) functions with the [`facet_row` and `facet_col` arguments](/python/facet-plots/) * `create_gantt`: use [`px.timeline`](/python/gantt/) - * `create_hexbin_mapbox`: use [`create_hexbin_map`](/python/hexbin-mapbox/) + * `create_hexbin_mapbox`: use [`create_hexbin_map`](/python/hexbin-map/) * `create_ohlc`: use [`go.Ohlc`](/python/ohlc-charts/) * `create_scatterplotmatrix`: use [`go.Splom`](/python/splom/) * `create_violin`: use [`go.Violin`](/python/violin/) diff --git a/doc/python/filled-area-tile-maps.md b/doc/python/filled-area-tile-maps.md index 8e0af02484b..68b2a7ef8cd 100644 --- a/doc/python/filled-area-tile-maps.md +++ b/doc/python/filled-area-tile-maps.md @@ -134,36 +134,7 @@ fig.update_layout( fig.show() ``` - -### Mapbox Maps - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -The earlier examples using `go.Scattermap` use [Maplibre](https://maplibre.org/maplibre-gl-js/docs/) for rendering. This trace was introduced in Plotly.py 5.24 and is now the recommended way to draw filled areas on tile-based maps. There is also a trace that uses [Mapbox](https://docs.mapbox.com), called `go.Scattermapbox`. - -To use the `Scattermapbox` trace type, in some cases you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. - -Here's one of the earlier examples rewritten to use `Scattermapbox`. - -```python -import plotly.graph_objects as go - -fig = go.Figure(go.Scattermapbox( - fill = "toself", - lon = [-74, -70, -70, -74], lat = [47, 47, 45, 45], - marker = { 'size': 10, 'color': "orange" })) - -fig.update_layout( - mapbox = { - 'style': "open-street-map", - 'center': {'lon': -73, 'lat': 46 }, - 'zoom': 5}, - showlegend = False) - -fig.show() -``` - #### Reference -See https://plotly.com/python/reference/scattermap/ for available attribute options, or for `go.Scattermapbox`, see https://plotly.com/python/reference/scattermapbox/. +See https://plotly.com/python/reference/scattermap/ for available attribute options. diff --git a/doc/python/hexbin-mapbox.md b/doc/python/hexbin-map.md similarity index 97% rename from doc/python/hexbin-mapbox.md rename to doc/python/hexbin-map.md index 3744e8377bd..373bab142fb 100644 --- a/doc/python/hexbin-mapbox.md +++ b/doc/python/hexbin-map.md @@ -26,11 +26,11 @@ jupyter: display_as: maps language: python layout: base - name: Hexbin Mapbox + name: Hexbin Map order: 13 page_type: u-guide - permalink: python/hexbin-mapbox/ - thumbnail: thumbnail/hexbin_mapbox.jpg + permalink: python/hexbin-map/ + thumbnail: thumbnail/hexbin_map.jpg --- #### Simple Count Hexbin diff --git a/doc/python/lines-on-tile-maps.md b/doc/python/lines-on-tile-maps.md index 47e1c57d1e5..df1a3e7676b 100644 --- a/doc/python/lines-on-tile-maps.md +++ b/doc/python/lines-on-tile-maps.md @@ -31,7 +31,7 @@ jupyter: page_type: example_index permalink: python/lines-on-tile-maps/ redirect_from: python/lines-on-mapbox/ - thumbnail: thumbnail/line_mapbox.jpg + thumbnail: thumbnail/line_map.jpg --- ### Lines on tile maps using Plotly Express @@ -99,7 +99,7 @@ fig.show() ### Lines on maps using `Scattermap` traces This example uses `go.Scattermap` and sets -the [mode](https://plotly.com/python/reference/scattermapbox/#scattermap-mode) attribute to a combination of markers and line. +the [mode](https://plotly.com/python/reference/scattermap/#scattermap-mode) attribute to a combination of markers and line. ```python import plotly.graph_objects as go @@ -127,48 +127,8 @@ fig.update_layout( fig.show() ``` -### Mapbox Maps - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -The earlier examples using `px.line_map` and `go.Scattermap` use [Maplibre](https://maplibre.org/maplibre-gl-js/docs/) for rendering. These traces were introduced in Plotly.py 5.24 and are now the recommended way to draw lines on tile-based maps. There are also traces that use [Mapbox](https://docs.mapbox.com): `px.line_mapbox` and `go.Scattermapbox` - -To plot on Mapbox maps with Plotly you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. - -To draw a line on your map, you either can use [`px.line_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.line_mapbox.html) in Plotly Express, or [`Scattermapbox`](https://plotly.com/python/reference/scattermapbox/) traces. Below we show you how to draw a line on Mapbox using Plotly Express. - -Here's an example of using `Scattermapbox`. - -```python -import plotly.graph_objects as go - -fig = go.Figure(go.Scattermapbox( - mode = "markers+lines", - lon = [10, 20, 30], - lat = [10, 20,30], - marker = {'size': 10})) - -fig.add_trace(go.Scattermapbox( - mode = "markers+lines", - lon = [-50, -60,40], - lat = [30, 10, -20], - marker = {'size': 10})) - -fig.update_layout( - margin ={'l':0,'t':0,'b':0,'r':0}, - mapbox = { - 'center': {'lon': 10, 'lat': 10}, - 'style': "open-street-map", - 'center': {'lon': -20, 'lat': -20}, - 'zoom': 1}) - -fig.show() -``` #### Reference See [function reference for `px.line_map`](https://plotly.com/python-api-reference/generated/plotly.express.line_map) or https://plotly.com/python/reference/scattermap/ for more information about the attributes available. - -For Mapbox-based tile maps, see [function reference for `px.line_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.line_mapbox) or -https://plotly.com/python/reference/scattermapbox/. diff --git a/doc/python/map-configuration.md b/doc/python/map-configuration.md index 59831eaaffc..353ea3d4aca 100644 --- a/doc/python/map-configuration.md +++ b/doc/python/map-configuration.md @@ -39,7 +39,7 @@ Plotly supports two different kinds of maps: - **[Tile-based maps](https://en.wikipedia.org/wiki/Tiled_web_map)** -If your figure is created with a `px.scatter_map`, `px.scatter_mapbox`, `px.line_map`, `px.line_mapbox`, `px.choropleth_map`, `px.choropleth_mapbox`, `px.density_map`, or `px.density_mapbox` function or otherwise contains one or more traces of type `go.Scattermap`, `go.Scattermapbox`, `go.Choroplethmap`, `go.Choroplethmapbox`, `go.Densitymap`, or `go.Densitymapbox`, the `layout.map` object in your figure contains configuration information for the map itself. +If your figure is created with a `px.scatter_map`, `px.line_map`, `px.choropleth_map`, or `px.density_map` function or otherwise contains one or more traces of type `go.Scattermap`, `go.Choroplethmap`, or `go.Densitymap`, the `layout.map` object in your figure contains configuration information for the map itself. - **Outline-based maps** diff --git a/doc/python/migrate-to-maplibre.md b/doc/python/migrate-to-maplibre.md index 4466165e500..ca06bc7f911 100644 --- a/doc/python/migrate-to-maplibre.md +++ b/doc/python/migrate-to-maplibre.md @@ -31,7 +31,7 @@ jupyter: page_type: u-guide permalink: python/mapbox-to-maplibre/ redirect_from: python/maplibre-migration/ - thumbnail: thumbnail/mapbox-layers.png + thumbnail: thumbnail/map-layers.png --- ## Migrating from Mapbox traces to MapLibre traces diff --git a/doc/python/orca-management.md b/doc/python/orca-management.md index d1ca867df59..9ff522a23dc 100644 --- a/doc/python/orca-management.md +++ b/doc/python/orca-management.md @@ -258,7 +258,6 @@ In addition to the `executable` property, the `plotly.io.orca.config` object can - **`default_format`**: The default image format used on export. One of `"png"`, `"jpeg"`, `"webp"`, `"svg"`, `"pdf"`, or `"eps"`. - **`mathjax`**: Location of the MathJax bundle needed to render LaTeX characters. Defaults to a CDN location. If fully offline export is required, set this to a local MathJax bundle. - **`topojson`**: Location of the topojson files needed to render choropleth traces. Defaults to a CDN location. If fully offline export is required, set this to a local directory containing the [Plotly.js topojson files](https://github.com/plotly/plotly.js/tree/master/dist/topojson). - - **`mapbox_access_token`**: Mapbox access token required to render `scattermapbox` traces. - **`use_xvfb`**: Whether to call orca using [Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) on Linux. Xvfb is needed for orca to work in a Linux environment if an X11 display server is not available. By default, plotly.py will automatically use Xvfb if it is installed, and no active X11 display server is detected. This can be set to `True` to force the use of Xvfb, or it can be set to `False` to disable the use of Xvfb. diff --git a/doc/python/performance.md b/doc/python/performance.md index 933fc251d42..0d413935bb7 100644 --- a/doc/python/performance.md +++ b/doc/python/performance.md @@ -133,7 +133,7 @@ Each `plotly` trace type is rendered with either SVG or WebGL. The following tra * Accelerated versions of SVG trace types: `scattergl`, `scatterpolargl`, * High-performance multidimensional trace types: `splom`, or `parcoords` * 3D trace types `scatter3d`, `surface`, `mesh3d`, `cone`, `streamtube`, `isosurface`, `volume` -* Mapbox Gl JS-powered trace types: `scattermap`, `choroplethmap`, `densitymap` +* MapLibre GL JS-powered trace types: `scattermap`, `choroplethmap`, `densitymap` ### WebGL Limitations and Tradeoffs diff --git a/doc/python/shapes.md b/doc/python/shapes.md index ac993d42838..25ec7f65a9e 100644 --- a/doc/python/shapes.md +++ b/doc/python/shapes.md @@ -51,7 +51,7 @@ The differences between these two approaches are that: ### Shape-drawing with Scatter traces -There are two ways to draw filled shapes: scatter traces and [layout.shapes](https://plotly.com/python/reference/layout/shapes/#layout-shapes-items-shape-type) which is mostly useful for the 2d subplots, and defines the shape type to be drawn, and can be rectangle, circle, line, or path (a custom SVG path). You also can use [scatterpolar](https://plotly.com/python/polar-chart/#categorical-polar-chart), scattergeo, [scattermapbox](https://plotly.com/python/filled-area-on-mapbox/#filled-scattermapbox-trace) to draw filled shapes on any kind of subplots. To set an area to be filled with a solid color, you need to define [Scatter.fill="toself"](https://plotly.com/python/reference/scatter/#scatter-fill) that connects the endpoints of the trace into a closed shape. If `mode=line` (default value), then you need to repeat the initial point of a shape at the end of the sequence to have a closed shape. +There are two ways to draw filled shapes: scatter traces and [layout.shapes](https://plotly.com/python/reference/layout/shapes/#layout-shapes-items-shape-type) which is mostly useful for the 2d subplots, and defines the shape type to be drawn, and can be rectangle, circle, line, or path (a custom SVG path). You also can use [scatterpolar](https://plotly.com/python/polar-chart/#categorical-polar-chart), scattergeo, [scattermap](https://plotly.com/python/filled-area-tile-maps/#filled-scattermap-trace) to draw filled shapes on any kind of subplots. To set an area to be filled with a solid color, you need to define [Scatter.fill="toself"](https://plotly.com/python/reference/scatter/#scatter-fill) that connects the endpoints of the trace into a closed shape. If `mode=line` (default value), then you need to repeat the initial point of a shape at the end of the sequence to have a closed shape. ```python import plotly.graph_objects as go diff --git a/doc/python/static-image-export.md b/doc/python/static-image-export.md index e9b7b317841..7aacd12cdd8 100644 --- a/doc/python/static-image-export.md +++ b/doc/python/static-image-export.md @@ -279,7 +279,6 @@ The following settings are available. `headers`: *New in 6.8.* A dict of HTTP headers Kaleido sends when fetching external resources during image export (for example, when fetching OpenStreetMap tiles for tile maps). Defaults to `{"X-Requested-With": "plotly.py"}`, which is required to comply with the [OpenStreetMap tile usage policy](https://operations.osmfoundation.org/policies/tiles/). Requires Kaleido v1.3.0 or later. -`mapbox_access_token`: The default Mapbox access token (Kaleido v0 only). Mapbox traces are deprecated. See the [MapLibre Migration](https://plotly.com/python/mapbox-to-maplibre/) page for more details. ### Set Defaults diff --git a/doc/python/static-image-generation-migration.md b/doc/python/static-image-generation-migration.md index f6476a9cb93..63b5872ba49 100644 --- a/doc/python/static-image-generation-migration.md +++ b/doc/python/static-image-generation-migration.md @@ -73,8 +73,6 @@ pio.defaults.default_format = "jpeg" # pio.kaleido.scope.default_format = "jpeg" ~~~ -The `mapbox_access_token` config setting is not available on `plotly.io.defaults` because Mapbox maps are deprecated and will be removed in a future version of Plotly.py. See [MapLibre Migration](https://plotly.com/python/mapbox-to-maplibre/) for more details. - If you are migrating from Orca, the following config settings do not apply to Kaleido: `server_url`, `port`, `timeout`, and `use_xvfb`, but other settings, such as `default_format`, can be accessed via `plotly.io.defaults`. ## Multiple Image Export diff --git a/doc/python/subplots.md b/doc/python/subplots.md index 4bcbc59993e..dd05d3baf93 100644 --- a/doc/python/subplots.md +++ b/doc/python/subplots.md @@ -431,7 +431,7 @@ Here are the possible values for the `type` option: - `"scene"`: 3D Cartesian subplot for scatter3d, cone, etc. - `"polar"`: Polar subplot for scatterpolar, barpolar, etc. - `"ternary"`: Ternary subplot for scatterternary. - - `"mapbox"`: Mapbox subplot for scattermapbox. + - `"map"`: Map subplot for scattermap. - `"domain"`: Subplot type for traces that are individually positioned. pie, parcoords, parcats, etc. - trace type: A trace type name (e.g. `"bar"`, `"scattergeo"`, `"carpet"`, `"mesh"`, etc.) which will be used to determine the appropriate subplot type for that trace. diff --git a/doc/python/tile-county-choropleth.md b/doc/python/tile-county-choropleth.md index c39923bf4f7..6917943e820 100644 --- a/doc/python/tile-county-choropleth.md +++ b/doc/python/tile-county-choropleth.md @@ -31,7 +31,7 @@ jupyter: page_type: example_index permalink: python/tile-county-choropleth/ redirect_from: python/mapbox-county-choropleth/ - thumbnail: thumbnail/mapbox-choropleth.png + thumbnail: thumbnail/map-choropleth.png --- A [Choropleth Map](https://en.wikipedia.org/wiki/Choropleth_map) is a map composed of colored polygons. It is used to represent spatial variations of a quantity. This page documents how to build **tile-map** choropleth maps, but you can also build [**outline** choropleth maps](/python/choropleth-maps). @@ -113,7 +113,7 @@ Get started with [the official Dash docs](https://dash.plotly.com/installation) ```python hide_code=true from IPython.display import IFrame snippet_url = 'https://python-docs-dash-snippets.herokuapp.com/python-docs-dash-snippets/' -IFrame(snippet_url + 'mapbox-county-choropleth', width='100%', height=1200) +IFrame(snippet_url + 'map-county-choropleth', width='100%', height=1200) ```

Sign up for Dash Club → Free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture. @@ -218,40 +218,7 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) fig.show() ``` -### Mapbox Maps - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -The earlier examples using `px.choropleth_map` and `go.Choroplethmap` use [Maplibre](https://maplibre.org/maplibre-gl-js/docs/) for rendering. These traces were introduced in Plotly.py 5.24 and are now the recommended way to create tile-based choropleth maps. There are also choropleth traces that use [Mapbox](https://docs.mapbox.com): `px.choropleth_mapbox` and `go.Choroplethmapbox` - -To plot on Mapbox maps with Plotly you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. - -Here's an example of using the Mapbox Light base map, which requires a free token. - -```python -token = open(".mapbox_token").read() # you will need your own token - -from urllib.request import urlopen -import json -with urlopen('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json') as response: - counties = json.load(response) - -import pandas as pd -df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/fips-unemp-16.csv", - dtype={"fips": str}) - -import plotly.graph_objects as go - -fig = go.Figure(go.Choroplethmapbox(geojson=counties, locations=df.fips, z=df.unemp, - colorscale="Viridis", zmin=0, zmax=12, marker_line_width=0)) -fig.update_layout(mapbox_style="light", mapbox_accesstoken=token, - mapbox_zoom=3, mapbox_center = {"lat": 37.0902, "lon": -95.7129}) -fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) -fig.show() -``` #### Reference See [function reference for `px.choropleth_map`](https://plotly.com/python-api-reference/generated/plotly.express.choropleth_map) or https://plotly.com/python/reference/choroplethmap/ for more information about the attributes available. - -For (deprecated) Mapbox-based tile maps, see [function reference for `px.choropleth_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.choropleth_mapbox) or https://plotly.com/python/reference/choroplethmapbox/. diff --git a/doc/python/tile-map-layers.md b/doc/python/tile-map-layers.md index d7c7beb7d7d..eb09c3c637c 100644 --- a/doc/python/tile-map-layers.md +++ b/doc/python/tile-map-layers.md @@ -31,7 +31,7 @@ jupyter: page_type: u-guide permalink: python/tile-map-layers/ redirect_from: python/mapbox-layers/ - thumbnail: thumbnail/mapbox-layers.png + thumbnail: thumbnail/map-layers.png --- @@ -42,7 +42,7 @@ Plotly supports two different kinds of maps: - **[Tile-based maps](https://en.wikipedia.org/wiki/Tiled_web_map)** -If your figure is created with a `px.scatter_map`, `px.scatter_mapbox`, `px.line_map`, `px.line_mapbox`, `px.choropleth_map`, `px.choropleth_mapbox`, `px.density_map`, or `px.density_mapbox` function or otherwise contains one or more traces of type `go.Scattermap`, `go.Scattermapbox`, `go.Choroplethmap`, `go.Choroplethmapbox`, `go.Densitymap`, or `go.Densitymapbox`, the `layout.map` or `layout.mapbox` object in your figure contains configuration information for the map itself. +If your figure is created with a `px.scatter_map`, `px.line_map`, `px.choropleth_map`, or `px.density_map` function or otherwise contains one or more traces of type `go.Scattermap`, `go.Choroplethmap`, or `go.Densitymap`, the `layout.map` object in your figure contains configuration information for the map itself. - **Outline-based maps** @@ -52,11 +52,10 @@ Geo maps are outline-based maps. If your figure is created with a `px.scatter_ge ## Tile Map Renderers -Tile-based traces in Plotly use Maplibre or Mapbox. +Tile-based traces in Plotly use Maplibre. Maplibre-based traces (new in 5.24) are ones generated in Plotly Express using `px.scatter_map`, `px.line_map`, `px.choropleth_map`, `px.density_map`, or Graph Objects using `go.Scattermap`, `go.Choroplethmap`, or `go.Densitymap`. -Mapbox-based traces are suffixed with `mapbox`, for example `go.Scattermapbox`. These are deprecated as of version 5.24 and we recommend using the Maplibre-based traces. ### Maplibre @@ -66,37 +65,36 @@ Maplibre-based tile maps have three different types of layers: - `layout.map.style` defines the lowest layers of the map, also known as the "base map". - The various traces in `data` are by default rendered above the base map (although this can be controlled via the `below` attribute). -- `layout.map.layers` is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute. +- `layout.map.layers` is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute). #### Base Maps in `layout.map.style`. The accepted values for `layout.map.style` are one of: -- "basic" -- "carto-darkmatter" -- "carto-darkmatter-nolabels" -- "carto-positron" -- "carto-positron-nolabels" -- "carto-voyager" -- "carto-voyager-nolabels" -- "dark" -- "light" -- "open-street-map" -- "outdoors" -- "satellite" -- "satellite-streets" -- "streets" -- "white-bg" - an empty white canvas which results in no external HTTP requests + +The accepted values for `layout.map.style` are one of: + +- `"white-bg"`, which yields an empty white canvas which results in no external HTTP requests +- `'carto-voyager'` (and `"basic"`, `"streets"`, `"outdoors"`, and `"light"`) which yields the [CARTO](https://github.com/cartodb/basemap-styles) Voyager basemap vector tiles +- `"carto-voyager-nolabels"` which yields the same tiles as the above but without text labels +- `"carto-positron"` (and `"light"`) which yields the [CARTO](https://github.com/cartodb/basemap-styles) Positron basemap vector tiles +- `"carto-positron-nolabels"` which yields the same tiles as the above but without text labels +- `"carto-darkmatter"` (and `"dark"`) which yields the [CARTO](https://github.com/cartodb/basemap-styles) Darkmatter basemap vector tiles +- `"carto-darkmatter-nolabels"` which yields the same tiles as the above but without text labels +- `"open-street-map"` which yields _raster_ tiles from [OpenStreetMap](https://wiki.openstreetmap.org/wiki/About_OpenStreetMap). +- `"satellite"` and `"satellite-streets"` which yield [custom-styled](https://github.com/plotly/plotly.js/blob/master/src/plots/map/styles/) maps using raster tiles from [ESRI / ArcGIS](http://www.esri.com) - A custom style URL. For example: https://tiles.stadiamaps.com/styles/stamen_watercolor.json?api_key=YOUR-API-KEY - A Map Style object as defined at https://maplibre.org/maplibre-style-spec/ +Note: Style values beginning with `"stamen-"` are no longer supported following the [transition to Maplibre](python/mapbox-to-maplibre/). The large number of aliases for `'carto-voyager'` are included for backwards-compatibility with previously-supported style values. + #### OpenStreetMap tiles -Here is a simple map rendered with OpenStreetMaps tiles. +Here is a simple map rendered with OpenStreetMap tiles. ```python @@ -219,110 +217,6 @@ fig.show() ``` - -### Mapbox - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -#### How Layers Work in Mapbox Tile Maps - -Mapbox tile maps are composed of various layers, of three different types: - -1. `layout.mapbox.style` defines the lowest layers, also known as your "base map" -2. The various traces in `data` are by default rendered above the base map (although this can be controlled via the `below` attribute). -3. `layout.mapbox.layers` is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute). - -#### Mapbox Access Tokens and When You Need Them - -The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox GL JS open-source library, which is integrated into Plotly.py. - -If your basemap in `layout.mapbox.style` uses data from the Mapbox _service_, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided in `layout.mapbox.access_token` (or, if using Plotly Express, via the `px.set_mapbox_access_token()` configuration function). - -If you basemap in `layout.mapbox.style` uses maps from the [Stadia Maps service](https://www.stadiamaps.com) (see below for details), you'll need to register for a Stadia Maps account and token. - - -#### Base Maps in `layout.mapbox.style` - -The accepted values for `layout.mapbox.style` are one of: - -- `"white-bg"` yields an empty white canvas which results in no external HTTP requests -- `"open-street-map"`, `"carto-positron"`, and `"carto-darkmatter"` yield maps composed of _raster_ tiles from various public tile servers which do not require signups or access tokens. -- `"basic"`, `"streets"`, `"outdoors"`, `"light"`, `"dark"`, `"satellite"`, or `"satellite-streets"` yield maps composed of _vector_ tiles from the Mapbox service, and _do_ require a Mapbox Access Token or an on-premise Mapbox installation. -- `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"` yield maps composed of _raster_ tiles from the [Stadia Maps service](https://www.stadiamaps.com), and require a Stadia Maps account and token. -- A Mapbox service style URL, which requires a Mapbox Access Token or an on-premise Mapbox installation. -- A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/ - -#### OpenStreetMap tiles: no token needed - -Here is a simple map rendered with OpenStreetMaps tiles, without needing a Mapbox Access Token: - - -```python -import pandas as pd -us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv") - -import plotly.express as px - -fig = px.scatter_mapbox(us_cities, lat="lat", lon="lon", hover_name="City", hover_data=["State", "Population"], - color_discrete_sequence=["fuchsia"], zoom=3, height=300) -fig.update_layout(mapbox_style="open-street-map") -fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) -fig.show() -``` - -#### Using `layout.mapbox.layers` to Specify a Base Map - -If you have access to your own private tile servers, or wish to use a tile server not included in the list above, the recommended approach is to set `layout.mapbox.style` to `"white-bg"` and to use `layout.mapbox.layers` with `below` to specify a custom base map. - -> If you omit the `below` attribute when using this approach, your data will likely be hidden by fully-opaque raster tiles! - -#### Base Tiles from the USGS: no token needed - -Here is an example of a map which uses a public USGS imagery map, specified in `layout.mapbox.layers`, and which is rendered _below_ the `data` layer. - - -```python -import pandas as pd -us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv") - -import plotly.express as px - -fig = px.scatter_mapbox(us_cities, lat="lat", lon="lon", hover_name="City", hover_data=["State", "Population"], - color_discrete_sequence=["fuchsia"], zoom=3, height=300) -fig.update_layout( - mapbox_style="white-bg", - mapbox_layers=[ - { - "below": 'traces', - "sourcetype": "raster", - "sourceattribution": "United States Geological Survey", - "source": [ - "https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}" - ] - } - ]) -fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) -fig.show() -``` - -#### Dark tiles from Mapbox service: free token needed - -Here is a map rendered with the `"dark"` style from the Mapbox service, which requires an Access Token: - -```python -token = open(".mapbox_token").read() # you will need your own token - -import pandas as pd -us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv") - -import plotly.express as px - -fig = px.scatter_mapbox(us_cities, lat="lat", lon="lon", hover_name="City", hover_data=["State", "Population"], - color_discrete_sequence=["fuchsia"], zoom=3, height=300) -fig.update_layout(mapbox_style="dark", mapbox_accesstoken=token) -fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) -fig.show() -``` ## Setting Map Bounds @@ -356,4 +250,4 @@ fig.show() #### Reference -See https://plotly.com/python/reference/layout/map/ for more information and options on Maplibre-based tile maps and https://plotly.com/python/reference/layout/mapbox/ for Mapbox-based tile maps. +See https://plotly.com/python/reference/layout/map/ for more information and options on Maplibre-based tile maps. \ No newline at end of file diff --git a/doc/python/tile-scatter-maps.md b/doc/python/tile-scatter-maps.md index 0dd6ae10565..57ea04114c7 100644 --- a/doc/python/tile-scatter-maps.md +++ b/doc/python/tile-scatter-maps.md @@ -31,7 +31,7 @@ jupyter: page_type: u-guide permalink: python/tile-scatter-maps/ redirect_from: python/scattermapbox/ - thumbnail: thumbnail/scatter-mapbox.jpg + thumbnail: thumbnail/scatter-map.jpg --- ### Basic example with Plotly Express @@ -320,62 +320,7 @@ fig.update_layout( fig.show() ``` -## Mapbox Maps - -> Mapbox traces are deprecated and may be removed in a future version of Plotly.py. - -The earlier examples using `px.scatter_map` and `go.Scattermap` use [Maplibre](https://maplibre.org/maplibre-gl-js/docs/) for rendering. These traces were introduced in Plotly.py 5.24 and are now the recommended way to create scatter plots on tile-based maps. There are also traces that use [Mapbox](https://docs.mapbox.com): `px.scatter_mapbox` and `go.Scattermapbox` - -To plot on Mapbox maps with Plotly you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. - -Here's the first example rewritten to use `px.scatter_mapbox`. - -```python -import plotly.express as px -px.set_mapbox_access_token(open(".mapbox_token").read()) -df = px.data.carshare() -fig = px.scatter_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour", size="car_hours", - color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10) -fig.show() - -``` - -And here's an example using Graph Objects: - -```python -import plotly.graph_objects as go - -mapbox_access_token = open(".mapbox_token").read() - -fig = go.Figure(go.Scattermapbox( - lat=['45.5017'], - lon=['-73.5673'], - mode='markers', - marker=go.scattermapbox.Marker( - size=14 - ), - text=['Montreal'], - )) - -fig.update_layout( - hovermode='closest', - mapbox=dict( - accesstoken=mapbox_access_token, - bearing=0, - center=go.layout.mapbox.Center( - lat=45, - lon=-73 - ), - pitch=0, - zoom=5 - ) -) - -fig.show() -``` #### Reference See [function reference for `px.scatter_map`](https://plotly.com/python-api-reference/generated/plotly.express.scatter_map) or https://plotly.com/python/reference/scattermap/ for more information about the attributes available. - -For Mapbox-based tile maps, see [function reference for `px.scatter_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.scatter_mapbox) or https://plotly.com/python/reference/scattermapbox/. diff --git a/doc/python/wide-form.md b/doc/python/wide-form.md index 88d9c08865a..0f49aed0282 100644 --- a/doc/python/wide-form.md +++ b/doc/python/wide-form.md @@ -38,7 +38,7 @@ jupyter: Plotly Express provides functions to visualize a variety of types of data. Most functions such as `px.bar` or `px.scatter` expect to operate on column-oriented data of the type you might store in a `DataFrame` (in either "long" or "wide" format, see below). These functions use Pandas internally to process the data, but also accept other types of DataFrames as arguments. See the [Plotly Express arguments page](/python/px-arguments/) for more details. -[`px.imshow` operates on matrix-like data](/python/imshow/) you might store in a `numpy` or `xarray` array and functions like [`px.choropleth` and `px.choropleth_mapbox` can operate on geographic data](/python/maps/) of the kind you might store in a GeoPandas `GeoDataFrame`. This page details how to provide a specific form of column-oriented data to 2D-Cartesian Plotly Express functions, but you can also check out our [detailed column-input-format documentation](/python/px-arguments/). +[`px.imshow` operates on matrix-like data](/python/imshow/) you might store in a `numpy` or `xarray` array and functions like [`px.choropleth` can operate on geographic data](/python/maps/) of the kind you might store in a GeoPandas `GeoDataFrame`. This page details how to provide a specific form of column-oriented data to 2D-Cartesian Plotly Express functions, but you can also check out our [detailed column-input-format documentation](/python/px-arguments/). ### Plotly Express works with Long-, Wide-, and Mixed-Form Data diff --git a/doc/unconverted/python/tesla-supercharging-stations.md b/doc/unconverted/python/tesla-supercharging-stations.md index 0d669bc255d..2acc02643f8 100644 --- a/doc/unconverted/python/tesla-supercharging-stations.md +++ b/doc/unconverted/python/tesla-supercharging-stations.md @@ -38,10 +38,6 @@ import plotly plotly.__version__ ``` -#### Mapbox Access Token - -To plot on Mapbox maps with Plotly you'll need a Mapbox account and a [Public Mapbox Access Token](https://www.mapbox.com/studio) which you can add to your [Plotly settings](https://plot.ly/settings/mapbox). If you're using a Chart Studio Enterprise server, please see additional instructions here: https://help.plot.ly/mapbox-atlas/. - #### Google Maps API In order to use the `Google Maps - Directions API`, you need to create an account with Google and get your API key [here](https://developers.google.com/maps/documentation/directions/). @@ -149,10 +145,8 @@ def plot_route_between_tesla_stations(address_start, address_end, zoom=3, endpt_ steps.append(end) # add ending coordinate to trip - mapbox_access_token = "ADD_YOUR_TOKEN_HERE" - data = Data([ - Scattermapbox( + Scattermap( lat=[item_x[0] for item_x in steps], lon=[item_y[1] for item_y in steps], mode='markers+lines', @@ -164,8 +158,7 @@ def plot_route_between_tesla_stations(address_start, address_end, zoom=3, endpt_ layout = Layout( autosize=True, hovermode='closest', - mapbox=dict( - accesstoken=mapbox_access_token, + map=dict( bearing=0, style='streets', center=dict( @@ -192,7 +185,7 @@ py.iplot(fig, filename='tesla-driving-directions-between-superchargers') ``` #### Reference -See http://moderndata.plot.ly/visualize-tesla-supercharging-stations-with-mysql-and-plotly/ to visualize Tesla supercharging stations with MYSQL and https://plot.ly/python/scattermapbox/ for more information on how to plot scatterplots on maps. +See http://moderndata.plot.ly/visualize-tesla-supercharging-stations-with-mysql-and-plotly/ to visualize Tesla supercharging stations with MYSQL and https://plot.ly/python/scattermap/ for more information on how to plot scatterplots on maps. ```python from IPython.display import display, HTML