You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
## [UNRELEASED]
6
6
7
7
### Updated
8
+
9
+
- Updated Plotly.js from version 2.27.0 to version 2.29.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2291----2024-02-12) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
10
+
- Add `layout.barcornerradius` and `trace.marker.cornerradius` properties to support rounding the corners of bar traces [[#6761](https://github.com/plotly/plotly.js/pull/6761)],
11
+
with thanks to [Displayr](https://www.displayr.com) for sponsoring development!
12
+
- Add `autotickangles` to cartesian and radial axes [[#6790](https://github.com/plotly/plotly.js/pull/6790)], with thanks to @my-tien for the contribution!
13
+
- Add `align` option to sankey nodes to control horizontal alignment [[#6800](https://github.com/plotly/plotly.js/pull/6800)],
14
+
with thanks to @adamreeve for the contribution!
15
+
- Add the possibility of loading "virtual-webgl" script for WebGL 1 to help display several WebGL contexts on a page [[#6784](https://github.com/plotly/plotly.js/pull/6784)], with thanks to @greggman for the contribution!
16
+
- Add options to use base64 encoding (`bdata`) and `shape` (for 2 dimensional arrays) to declare various typed arrays i.e. `dtype=(float64|float32|int32|int16|int8|uint32|uint16|uint8)`[[#5230](https://github.com/plotly/plotly.js/pull/5230)]
17
+
- Adjust stamen styles to point to `stadiamaps.com`, the users may also need to provide their own API_KEY via `config.mapboxAccessToken`[[#6776](https://github.com/plotly/plotly.js/pull/6776), [#6778](https://github.com/plotly/plotly.js/pull/6778)]
8
18
- Removed Python 3.6 and Python 3.7 support [[#4492](https://github.com/plotly/plotly.py/pull/4492)]
If `tickangle` is not explicitly set, its default value is `auto`, meaning if the label needs to be rotated to avoid labels overlapping, it will rotate by either 30 or 90 degrees. Using `autotickangles`, you can also specify a list of angles for `tickangle` to use. If `tickangle` is `auto` and you provide a list of angles to `autotickangles`, the label angle will be set to the first value in the list that prevents overlap.
The `tickvals` and `ticktext` axis properties can be used together to display custom tick label text at custom locations along an axis. They should be set to lists of the same length where the `tickvals` list contains positions along the axis, and `ticktext` contains the strings that should be displayed at the corresponding positions.
You can round the corners on all bar traces in a figure by setting `barcornerradius` on the figure's layout. `barcornerradius` can be a number of pixels or a percentage of the bar width (using a string ending in %, for example "20%").
491
+
492
+
In this example, we set all bars to have a radius of 15 pixels.
493
+
494
+
```python
495
+
import plotly.graph_objects as go
496
+
from plotly import data
497
+
498
+
df = data.medals_wide()
499
+
500
+
fig = go.Figure(
501
+
data=[
502
+
go.Bar(x=df.nation, y=df.gold, name="Gold"),
503
+
go.Bar(x=df.nation, y=df.silver, name="Silver"),
504
+
go.Bar(x=df.nation, y=df.bronze, name="Bronze"),
505
+
],
506
+
layout=dict(
507
+
barcornerradius=15,
508
+
),
509
+
)
510
+
511
+
fig.show()
512
+
```
513
+
514
+
When you don't want all bar traces in a figure to have the same rounded corners, you can instead configure rounded corners on each trace using `marker.cornerradius`. In this example, which uses subplots, the first trace has a corner radius of 30 pixels, the second trace has a bar corner radius of 30% of the bar width, and the third trace has no rounded corners set.
Copy file name to clipboardExpand all lines: doc/python/mapbox-density-heatmaps.md
+53-8Lines changed: 53 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
format_name: markdown
8
-
format_version: '1.2'
9
-
jupytext_version: 1.3.0
8
+
format_version: '1.3'
9
+
jupytext_version: 1.14.6
10
10
kernelspec:
11
-
display_name: Python 3
11
+
display_name: Python 3 (ipykernel)
12
12
language: python
13
13
name: python3
14
14
language_info:
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.7.3
23
+
version: 3.10.11
24
24
plotly:
25
25
description: How to make a Mapbox Density Heatmap in Python with Plotly.
26
26
display_as: maps
@@ -35,9 +35,10 @@ jupyter:
35
35
36
36
#### Mapbox Access Token
37
37
38
-
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.
38
+
To plot on Mapbox maps with Plotly, you may need a [Mapbox account and token](https://www.mapbox.com/studio) or a [Stadia Maps account and token](https://www.stadiamaps.com), depending on base map (`mapbox_style`) you use. On this page, we show how to use the "open-street-map" base map, which doesn't require a token, and a "stamen" base map, which requires a Stadia Maps token. See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more examples.
39
39
40
-
### Stamen Terrain base map (no token needed): density mapbox with `plotly.express`
40
+
41
+
### OpenStreetMap base map (no token needed): density mapbox with `plotly.express`
41
42
42
43
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
### Stamen Terrain base map (Stadia Maps token needed): density mapbox with `plotly.express`
60
+
61
+
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`.
62
+
63
+
```python
64
+
import plotly.express as px
65
+
import pandas as pd
66
+
67
+
token =open(".mapbox_token").read() # you will need your own token
### Stamen Terrain base map (no token needed): density mapbox with `plotly.graph_objects`
78
+
<!-- #endregion -->
79
+
80
+
### OpenStreetMap base map (no token needed): density mapbox with `plotly.graph_objects`
58
81
59
82
If Plotly Express does not provide a good starting point, it is also possible to use [the more generic `go.Densitymapbox` class from `plotly.graph_objects`](/python/graph-objects/).
### Stamen Terrain base map (Stadia Maps token needed): density mapbox with `plotly.graph_objects`
98
+
99
+
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`.
100
+
101
+
102
+
```python
103
+
import plotly.graph_objects as go
104
+
import pandas as pd
105
+
106
+
token =open(".mapbox_token").read() # you will need your own token
Copy file name to clipboardExpand all lines: doc/python/mapbox-layers.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ jupyter:
6
6
extension: .md
7
7
format_name: markdown
8
8
format_version: '1.3'
9
-
jupytext_version: 1.14.1
9
+
jupytext_version: 1.14.6
10
10
kernelspec:
11
11
display_name: Python 3 (ipykernel)
12
12
language: python
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.8.0
23
+
version: 3.10.11
24
24
plotly:
25
25
description: How to make Mapbox maps in Python with various base layers, with
26
26
or without needing a Mapbox Access token.
@@ -55,17 +55,21 @@ Mapbox tile maps are composed of various layers, of three different types:
55
55
56
56
#### Mapbox Access Tokens and When You Need Them
57
57
58
-
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).
58
+
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.
59
+
60
+
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).
61
+
62
+
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.
59
63
60
-
> If your `layout.mapbox.style` does not use data from the Mapbox service, you do _not_ need to register for a Mapbox account.
61
64
62
65
#### Base Maps in `layout.mapbox.style`
63
66
64
67
The accepted values for `layout.mapbox.style` are one of:
65
68
66
69
-`"white-bg"` yields an empty white canvas which results in no external HTTP requests
67
-
-`"open-street-map"`, `"carto-positron"`, `"carto-darkmatter"`, `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"`yield maps composed of _raster_ tiles from various public tile servers which do not require signups or access tokens
70
+
-`"open-street-map"`, `"carto-positron"`, or `"carto-darkmatter"`yield maps composed of _raster_ tiles from various public tile servers which do not require signups or access tokens.
68
71
-`"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.
72
+
-`"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.
69
73
- A Mapbox service style URL, which requires a Mapbox Access Token or an on-premise Mapbox installation.
70
74
- A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/
#### Base Tiles from the USGS, radar overlay from Environment Canada: no token needed
132
133
133
134
Here is the same example, with in addition, a WMS layer from Environment Canada which displays near-real-time radar imagery in partly-transparent raster tiles, rendered above the `go.Scattermapbox` trace, as is the default:
0 commit comments