Skip to content

Commit 4fc1402

Browse files
authored
Merge pull request #4577 from plotly/make-docs-updates-5-21-live
Make docs updates for 5.21 live
2 parents 44a1dc3 + 05aeeb3 commit 4fc1402

File tree

100 files changed

+1741
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1741
-132
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ jobs:
447447
resource_class: xlarge
448448
docker:
449449
# specify the version you desire here
450-
# use `-browsers` prefix for selenium tests, for example, `3.6.1-browsers`
450+
# use `-browsers` prefix for selenium tests, for example, `3.9-browsers`
451451
- image: cimg/python:3.9-browsers
452452

453453
steps:

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [5.21.0] - 2024-04-17
6+
7+
### Updated
8+
- Updated Plotly.js from version 2.30.0 to version 2.31.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2311----2024-04-15) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
9+
- Add `zorder` attribute to various cartesian traces for controlling stacking order of SVG traces drawn into a subplot [[#6918](https://github.com/plotly/plotly.js/pull/6918), [#6953](https://github.com/plotly/plotly.js/pull/6953)],
10+
This feature was anonymously sponsored: thank you to our sponsor!
11+
- Add "between" option to shape layer for placing them above grid lines and below traces [[#6927](https://github.com/plotly/plotly.js/pull/6927)],
12+
with thanks to @my-tien for the contribution!
13+
- Add "raw" `sizemode` to cone trace [[#6938](https://github.com/plotly/plotly.js/pull/6938)]
14+
- Add `layout.hoversubplots` to enable hover effects across multiple cartesian suplots sharing one axis [[#6947](https://github.com/plotly/plotly.js/pull/6947), [#6950](https://github.com/plotly/plotly.js/pull/6950)]
15+
16+
### Fixed
17+
- Fixed `orjson` loading issue [[#4562](https://github.com/plotly/plotly.py/pull/4562)]
18+
519
## [5.20.0] - 2024-03-13
620

721
### Updated

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
## Quickstart
3535

36-
`pip install plotly==5.20.0`
36+
`pip install plotly==5.21.0`
3737

3838
Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):
3939

@@ -78,13 +78,13 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
7878
plotly.py may be installed using pip...
7979

8080
```
81-
pip install plotly==5.20.0
81+
pip install plotly==5.21.0
8282
```
8383

8484
or conda.
8585

8686
```
87-
conda install -c plotly plotly=5.20.0
87+
conda install -c plotly plotly=5.21.0
8888
```
8989

9090
### JupyterLab Support
@@ -106,7 +106,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,
106106

107107
```
108108
# JupyterLab 2.x renderer support
109-
jupyter labextension install jupyterlab-plotly@5.20.0 @jupyter-widgets/jupyterlab-manager
109+
jupyter labextension install jupyterlab-plotly@5.21.0 @jupyter-widgets/jupyterlab-manager
110110
```
111111

112112
Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.

binder/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jupytext
2-
plotly==5.20.0
2+
plotly==5.21.0
33
jupyter
44
notebook
55
pandas==1.2.0

contributing.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,30 @@ the `plotly/plotly.js` GitHub repository (and place them in
224224
`plotly/package_data`). It will then regenerate all of the `graph_objs`
225225
classes based on the new schema.
226226

227-
For dev branches, it is also possible to use `updateplotlyjsdev --devrepo reponame --devbranch branchname` to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively.
227+
For dev branches, it is also possible to use `updateplotlyjsdev` in two configurations:
228+
229+
### CircleCI Release
230+
231+
If your devbranch is part of the official plotly.js repository, you can use
232+
```bash
233+
python setup.py updateplotlyjsdev --devrepo reponame --devbranch branchname
234+
```
235+
to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively.
236+
237+
### Local Repository
238+
239+
If you have a local repository of `plotly.js` you'd like to try, you can run:
240+
241+
```bash
242+
# In your plotly.js/ directory, prepare the package:
243+
244+
$ npm run build
245+
$ npm pack
246+
$ mv plotly.js-*.tgz plotly.js.tgz
247+
248+
# In your plotly.py/packages/python/plotly/ directory:
249+
$ python setup.py updateplotlyjsdev --local /path/to/your/plotly.js/
250+
```
228251

229252
## Testing
230253

doc/apidoc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ""
2828
# The full version, including alpha/beta/rc tags
29-
release = "5.20.0"
29+
release = "5.21.0"
3030

3131

3232
# -- General configuration ---------------------------------------------------

doc/python/cone-plot.md

+43-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
9-
jupytext_version: 1.3.0
8+
format_version: '1.3'
9+
jupytext_version: 1.16.1
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.10.11
2424
plotly:
2525
description: How to make 3D Cone plots in Python with Plotly.
2626
display_as: 3d_charts
@@ -126,5 +126,43 @@ fig.update_layout(scene=dict(aspectratio=dict(x=1, y=1, z=0.8),
126126
fig.show()
127127
```
128128

129+
### Sizemode
130+
131+
Earlier examples use `sizemode="absolute"` when adjusting the cone size scaling with `sizeref`. `sizemode` also supports `raw`(new in 5.21) and `scaled`.
132+
133+
```python
134+
import plotly.graph_objects as go
135+
import pandas as pd
136+
137+
df = pd.read_csv(
138+
"https://raw.githubusercontent.com/plotly/datasets/master/cone_plot_data.csv"
139+
)
140+
141+
fig = go.Figure(
142+
data=go.Cone(
143+
x=df["x"],
144+
y=df["y"],
145+
z=df["z"],
146+
u=df["u"],
147+
v=df["v"],
148+
w=df["w"],
149+
sizemode="raw",
150+
sizeref=0.1,
151+
colorscale="Portland",
152+
cmin=0,
153+
cmax=80,
154+
hoverinfo="u+v+w+text",
155+
text="-> wind <-",
156+
),
157+
layout=dict(
158+
width=900, height=600, scene=dict(camera=dict(eye=dict(x=1.2, y=0, z=0.6)))
159+
),
160+
)
161+
162+
163+
fig.show()
164+
165+
```
166+
129167
#### Reference
130-
See https://plotly.com/python/reference/ for more information and chart attribute options!
168+
See https://plotly.com/python/reference/ for more information and chart attribute options!

doc/python/getting-started.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
5858
`plotly` may be installed using `pip`:
5959

6060
```
61-
$ pip install plotly==5.20.0
61+
$ pip install plotly==5.21.0
6262
```
6363

6464
or `conda`:
6565

6666
```
67-
$ conda install -c plotly plotly=5.20.0
67+
$ conda install -c plotly plotly=5.21.0
6868
```
6969
This package contains everything you need to write figures to standalone HTML files.
7070

@@ -152,7 +152,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,
152152

153153
```
154154
# JupyterLab 2.x renderer support
155-
jupyter labextension install jupyterlab-plotly@5.20.0 @jupyter-widgets/jupyterlab-manager
155+
jupyter labextension install jupyterlab-plotly@5.21.0 @jupyter-widgets/jupyterlab-manager
156156
```
157157

158158
Please check out our [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple python environments inside Jupyter.

doc/python/graphing-multiple-chart-types.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.16.1
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.0
23+
version: 3.10.11
2424
plotly:
2525
description: How to design figures with multiple chart types in python.
2626
display_as: file_settings
@@ -208,5 +208,41 @@ fig.add_trace(
208208
fig.show()
209209
```
210210

211+
#### Trace Zorder
212+
213+
*New in 5.21*
214+
215+
You can move a trace in front of or behind another trace by setting its `zorder`. All traces have a default `zorder` of `0`. In the following example, we set `zorder` on the bar trace to `1` to move it in front of the scatter trace.
216+
217+
```python
218+
import plotly.graph_objects as go
219+
220+
x = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
221+
y_bar = [10, 15, 7, 10, 17, 15, 14, 20, 16, 19, 15, 17]
222+
y_area = [12, 13, 10, 14, 15, 13, 16, 18, 15, 17, 14, 16]
223+
224+
area_trace = go.Scatter(
225+
x=x,
226+
y=y_area,
227+
fill="tozeroy",
228+
mode="lines+markers",
229+
name="Area Trace with default `zorder` of 0",
230+
line=dict(color="lightsteelblue"),
231+
)
232+
233+
bar_trace = go.Bar(
234+
x=x,
235+
y=y_bar,
236+
name="Bar Trace with `zorder` of 1",
237+
zorder=1,
238+
marker=dict(color="lightslategray"),
239+
)
240+
241+
fig = go.Figure(data=[area_trace, bar_trace])
242+
243+
fig.show()
244+
245+
```
246+
211247
#### Reference
212248
See https://plotly.com/python/reference/ for more information and attribute options!

doc/python/hover-text-and-formatting.md

+34-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.16.1
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.8
23+
version: 3.10.11
2424
plotly:
2525
description: How to use hover text and formatting in Python with Plotly.
2626
display_as: file_settings
@@ -116,6 +116,37 @@ fig.update_layout(hovermode='x unified')
116116
fig.show()
117117
```
118118

119+
#### Hover on Subplots
120+
121+
*New in 5.21*
122+
123+
Use `hoversubplots` to define how hover effects expand to additional subplots. With `hoversubplots=axis`, hover effects are included on stacked subplots using the same axis when `hovermode` is set to `x`, `x unified`, `y`, or `y unified`.
124+
125+
```python
126+
import plotly.graph_objects as go
127+
import pandas as pd
128+
from plotly import data
129+
130+
df = data.stocks()
131+
132+
layout = dict(
133+
hoversubplots="axis",
134+
title="Stock Price Changes",
135+
hovermode="x",
136+
grid=dict(rows=3, columns=1),
137+
)
138+
139+
data = [
140+
go.Scatter(x=df["date"], y=df["AAPL"], xaxis="x", yaxis="y", name="Apple"),
141+
go.Scatter(x=df["date"], y=df["GOOG"], xaxis="x", yaxis="y2", name="Google"),
142+
go.Scatter(x=df["date"], y=df["AMZN"], xaxis="x", yaxis="y3", name="Amazon"),
143+
]
144+
145+
fig = go.Figure(data=data, layout=layout)
146+
147+
fig.show()
148+
```
149+
119150
### Customizing Hover Label Appearance
120151

121152
Hover label text and colors default to trace colors in hover modes other than `unified`, and can be globally set via the `layout.hoverlabel` attributes. Hover label appearance can also be controlled per trace in `<trace>.hoverlabel`.

doc/python/line-and-scatter.md

+44-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.16.1
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.0
23+
version: 3.10.11
2424
plotly:
2525
description: How to make scatter plots in Python with Plotly.
2626
display_as: basic
@@ -426,6 +426,48 @@ fig = go.Figure(data=go.Scatter(
426426
fig.show()
427427
```
428428

429+
#### Trace Zorder
430+
431+
*New in 5.21*
432+
433+
For many trace types, including `go.Scatter`, you can define the order traces are drawn in by setting a `zorder`. Traces with a higher `zorder` appear at the front, with traces with a lower `zorder` at the back. In this example, we give our trace for 'France' the highest `zorder`, meaning it is drawn in front of the other two traces:
434+
435+
```python
436+
import plotly.graph_objects as go
437+
import plotly.data as data
438+
439+
df = data.gapminder()
440+
441+
df_europe = df[df['continent'] == 'Europe']
442+
443+
trace1 = go.Scatter(x=df_europe[df_europe['country'] == 'France']['year'],
444+
y=df_europe[df_europe['country'] == 'France']['lifeExp'],
445+
mode='lines+markers',
446+
zorder=3,
447+
name='France',
448+
marker=dict(size=15))
449+
450+
trace2 = go.Scatter(x=df_europe[df_europe['country'] == 'Germany']['year'],
451+
y=df_europe[df_europe['country'] == 'Germany']['lifeExp'],
452+
mode='lines+markers',
453+
zorder=1,
454+
name='Germany',
455+
marker=dict(size=15))
456+
457+
trace3 = go.Scatter(x=df_europe[df_europe['country'] == 'Spain']['year'],
458+
y=df_europe[df_europe['country'] == 'Spain']['lifeExp'],
459+
mode='lines+markers',
460+
zorder=2,
461+
name='Spain',
462+
marker=dict(size=15))
463+
464+
layout = go.Layout(title='Life Expectancy in Europe Over Time')
465+
466+
fig = go.Figure(data=[trace1, trace2, trace3], layout=layout)
467+
468+
fig.show()
469+
```
470+
429471
#### Large Data Sets
430472

431473
Now in Plotly you can implement WebGL with `Scattergl()` in place of `Scatter()` <br>

0 commit comments

Comments
 (0)