Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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] $<"
Expand Down
13 changes: 0 additions & 13 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -391,8 +380,6 @@ Check `build/failures/<page-name>` 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

Expand Down
5 changes: 0 additions & 5 deletions doc/apidoc/plotly.express.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down
3 changes: 0 additions & 3 deletions doc/apidoc/plotly.graph_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ Map Traces
Scattermap
Choroplethmap
Densitymap
Scattermapbox
Choroplethmapbox
Densitymapbox

Specialized Traces
-----------
Expand Down
4 changes: 2 additions & 2 deletions doc/python/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
51 changes: 2 additions & 49 deletions doc/python/density-heatmaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -67,55 +67,8 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
```

<!-- #region -->
### 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()
```

<!-- #endregion -->

<!-- #region -->
#### 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()
```


<!-- #endregion -->

#### 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/.
4 changes: 2 additions & 2 deletions doc/python/figure-factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand All @@ -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/)
Expand Down
31 changes: 1 addition & 30 deletions doc/python/filled-area-tile-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,36 +134,7 @@ fig.update_layout(
fig.show()
```

<!-- #region -->
### 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()
```
<!-- #endregion -->

#### 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.
6 changes: 3 additions & 3 deletions doc/python/hexbin-mapbox.md → doc/python/hexbin-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 2 additions & 42 deletions doc/python/lines-on-tile-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/.
2 changes: 1 addition & 1 deletion doc/python/map-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
2 changes: 1 addition & 1 deletion doc/python/migrate-to-maplibre.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc/python/orca-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
2 changes: 1 addition & 1 deletion doc/python/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/python/shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc/python/static-image-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions doc/python/static-image-generation-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/python/subplots.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Loading
Loading