Skip to content

Commit 3b561c2

Browse files
authored
Merge pull request #4321 from plotly/update-production-docs
Update doc-prod docs with new release docs
2 parents 851dcc3 + feb50c9 commit 3b561c2

File tree

302 files changed

+6487
-2370
lines changed

Some content is hidden

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

302 files changed

+6487
-2370
lines changed

Diff for: .flake8

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

Diff for: CHANGELOG.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55

6-
## UNRELEASED
6+
## [5.16.0] - 2023-08-11
77

88
### Updated
9-
- Updated Plotly.js from version 2.24.1 to version 2.24.2. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2242----2023-06-09) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module.
9+
- Updated Plotly.js from version 2.24.1 to version 2.25.2. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2252----2023-08-11) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
10+
- Add "Equal Earth" projection to geo subplots [[#6670](https://github.com/plotly/plotly.js/pull/6670)],
11+
with thanks to @apparebit for the contribution!
12+
- Add options to include legends for shapes and `newshape` [[#6653](https://github.com/plotly/plotly.js/pull/6653)]
1013
- `px` methods now accept data-frame-like objects that support a [dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/index.html), such as polars, vaex, modin etc. This protocol has priority on `to_pandas` call, but will only be used if pandas>=2.0.2 is installed in the environment.
14+
- `px` methods now accept data-frame-like objects that support a `toPandas()` method, such as Spark DataFrames, or a `to_pandas_df()` method, such as Vaex DataFrames.
15+
16+
### Fixed
17+
- Fixed Pandas performance warning issue caused by multiple `frame.insert` [[#4246](https://github.com/plotly/plotly.py/pull/4246)]
1118

1219
## [5.15.0] - 2023-06-08
1320

@@ -23,7 +30,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2330
this feature was anonymously sponsored: thank you to our sponsor!
2431
- Add `legend.xref` and `legend.yref` to enable container-referenced positioning of legends [[#6589](https://github.com/plotly/plotly.js/pull/6589)], with thanks to [Gamma Technologies](https://www.gtisoft.com/) for sponsoring the related development.
2532
- Add `colorbar.xref` and `colorbar.yref` to enable container-referenced positioning of colorbars [[#6593](https://github.com/plotly/plotly.js/pull/6593)], with thanks to [Gamma Technologies](https://www.gtisoft.com/) for sponsoring the related development.
26-
- `px` methods now accept data-frame-like objects that support a `to_pandas()` method, such as polars, cudf, vaex etc
33+
- `px` methods now accept data-frame-like objects that support a `to_pandas()` method, such as polars, cudf, vaex etc [[#4244](https://github.com/plotly/plotly.py/pull/4244)], [[#4286](https://github.com/plotly/plotly.py/pull/4286)]
2734

2835
### Fixed
2936
- Fixed another compatibility issue with Pandas 2.0, just affecting `px.*(line_close=True)` [[#4190](https://github.com/plotly/plotly.py/pull/4190)]

Diff for: 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.15.0`
36+
`pip install plotly==5.16.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.15.0
81+
pip install plotly==5.16.0
8282
```
8383

8484
or conda.
8585

8686
```
87-
conda install -c plotly plotly=5.15.0
87+
conda install -c plotly plotly=5.16.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.15.0 @jupyter-widgets/jupyterlab-manager
109+
jupyter labextension install jupyterlab-plotly@5.16.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.

Diff for: binder/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jupytext
2-
plotly==5.15.0
2+
plotly==5.16.0
33
jupyter
44
notebook
55
pandas==1.0.3

Diff for: doc/apidoc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# The short X.Y version
2929
version = ""
3030
# The full version, including alpha/beta/rc tags
31-
release = "5.15.0"
31+
release = "5.16.0"
3232

3333

3434
# -- General configuration ---------------------------------------------------

Diff for: doc/python/axes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jupyter:
3333
thumbnail: thumbnail/axes.png
3434
---
3535

36-
This tutorial explain how to set the properties of [2-dimensional Cartesian axes](/python/figure-structure/#2d-cartesian-trace-types-and-subplots), namely [`go.layout.XAxis`](/python/reference/layout/xaxis/) and [`go.layout.YAxis`](python/reference/layout/xaxis/).
36+
This tutorial explain how to set the properties of [2-dimensional Cartesian axes](/python/figure-structure/#2d-cartesian-trace-types-and-subplots), namely [`go.layout.XAxis`](/python/reference/layout/xaxis/) and [`go.layout.YAxis`](/python/reference/layout/xaxis/).
3737

3838
Other kinds of subplots and axes are described in other tutorials:
3939

@@ -154,7 +154,7 @@ fig.update_yaxes(ticklabelposition="inside top", title=None)
154154
fig.show()
155155
```
156156

157-
#### Specifying Label Aliases
157+
#### Specifying Label Aliases
158158

159159
*New in 5.14*
160160

Diff for: doc/python/colorscales.md

+2-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.5
9+
jupytext_version: 1.14.6
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.10.11
23+
version: 3.10.8
2424
plotly:
2525
description: How to set, create and control continuous color scales and color
2626
bars in scatter, bar, map and heatmap figures.

Diff for: 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.15.0
61+
$ pip install plotly==5.16.0
6262
```
6363

6464
or `conda`:
6565

6666
```
67-
$ conda install -c plotly plotly=5.15.0
67+
$ conda install -c plotly plotly=5.16.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.15.0 @jupyter-widgets/jupyterlab-manager
155+
jupyter labextension install jupyterlab-plotly@5.16.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.

Diff for: doc/python/legend.md

+85-13
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.6
9+
jupytext_version: 1.14.7
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.10.11
23+
version: 3.10.4
2424
plotly:
2525
description: How to configure and style the legend in Plotly with Python.
2626
display_as: file_settings
@@ -35,7 +35,7 @@ jupyter:
3535

3636
### Trace Types, Legends and Color Bars
3737

38-
[Traces](/python/figure-structure) of most types can be optionally associated with a single legend item in the [legend](/python/legend/). Whether or not a given trace appears in the legend is controlled via the `showlegend` attribute. Traces which are their own subplots (see above) do not support this, with the exception of traces of type `pie` and `funnelarea` for which every distinct color represented in the trace gets a separate legend item. Users may show or hide traces by clicking or double-clicking on their associated legend item. Traces that support legend items also support the `legendgroup` attribute, and all traces with the same legend group are treated the same way during click/double-click interactions.
38+
[Traces](/python/figure-structure) of most types and shapes can be optionally associated with a single legend item in the [legend](/python/legend/). Whether or not a given trace or shape appears in the legend is controlled via the `showlegend` attribute. Traces which are their own subplots (see above) do not support this, with the exception of traces of type `pie` and `funnelarea` for which every distinct color represented in the trace gets a separate legend item. Users may show or hide traces by clicking or double-clicking on their associated legend item. Traces that support legend items and shapes also support the `legendgroup` attribute, and all traces and shapes with the same legend group are treated the same way during click/double-click interactions.
3939

4040
The fact that legend items are linked to traces means that when using [discrete color](/python/discrete-color/), a figure must have one trace per color in order to get a meaningful legend. [Plotly Express has robust support for discrete color](/python/discrete-color/) to make this easy.
4141

@@ -97,26 +97,66 @@ fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2,1]))
9797
fig.show()
9898
```
9999

100-
*New in v5.0*
100+
*New in 5.16*
101101

102-
The `legendrank` attribute of a trace can be used to control its placement within the legend, without regard for its placement in the `data` list.
102+
If you have shapes that are configured to appear in a legend, these are displayed after all traces:
103103

104-
The default `legendrank` for traces is 1000 and ties are broken as described above, meaning that any trace can be pulled up to the top if it is the only one with a legend rank less than 1000 and pushed to the bottom if it is the only one with a rank greater than 1000.
104+
```python
105+
import plotly.graph_objects as go
106+
107+
fig = go.Figure()
108+
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1, 2]))
109+
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2, 1]))
110+
fig.add_shape(
111+
name="first shape",
112+
showlegend=True,
113+
type="rect",
114+
xref="paper",
115+
line=dict(dash="dash"),
116+
x0=0.85,
117+
x1=0.95,
118+
y0=0,
119+
y1=1.5,
120+
)
121+
fig.add_trace(go.Bar(name="third", x=["a", "b"], y=[1, 2]))
122+
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2, 1]))
123+
124+
fig.show()
125+
126+
```
127+
128+
The `legendrank` attribute of a trace or shape can be used to control its placement in the legend.
129+
The default `legendrank` for traces and shapes is 1000. When all traces and shapes have the same `legendrank`, traces appear in the order they appear in the data, followed by shapes in the order they are defined.
130+
131+
Any trace or shape can be pulled up to the top of the legend if it is the only one with a legend rank less than 1000 and pushed to the bottom if it is the only one with a rank greater than 1000.
132+
133+
In this example, we add a `legendrank` for each trace and shape, giving the shape the lowest rank so it appears first, and moving the first trace defined to the bottom of the legend by giving it the highest rank.
105134

106135
```python
107136
import plotly.graph_objects as go
108137

109138
fig = go.Figure()
110-
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2,1], legendrank=4))
111-
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2,1], legendrank=2))
112-
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1,2], legendrank=1))
139+
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2,1], legendrank=5))
140+
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2,1], legendrank=4))
141+
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1,2], legendrank=2))
113142
fig.add_trace(go.Bar(name="third", x=["a", "b"], y=[1,2], legendrank=3))
143+
fig.add_shape(
144+
legendrank=1,
145+
showlegend=True,
146+
type="line",
147+
xref="paper",
148+
line=dict(dash="5px"),
149+
x0=0.05,
150+
x1=0.45,
151+
y0=1.5,
152+
y1=1.5,
153+
)
114154
fig.show()
115155
```
116156

117157
#### Showing and Hiding the Legend
118158

119-
By default the legend is displayed on Plotly charts with multiple traces, and this can be explicitly set with the `layout.showlegend` attribute:
159+
By default the legend is displayed on Plotly charts with multiple traces, and this can be explicitly set with the `layout.showlegend` attribute.
120160

121161
```python
122162
import plotly.express as px
@@ -253,7 +293,30 @@ When creating figures using [graph objects](/python/graph-objects/) without usin
253293

254294
#### Legend Item Names
255295

256-
Legend items appear per trace, and the legend item name is taken from the trace's `name` attribute.
296+
For traces, legend items appear per trace, and the legend item name is taken from the trace's `name` attribute.
297+
298+
```python
299+
import plotly.graph_objects as go
300+
301+
fig = go.Figure()
302+
303+
fig.add_trace(go.Scatter(
304+
x=[1, 2, 3, 4, 5],
305+
y=[1, 2, 3, 4, 5],
306+
name="Positive"
307+
))
308+
309+
fig.add_trace(go.Scatter(
310+
x=[1, 2, 3, 4, 5],
311+
y=[5, 4, 3, 2, 1],
312+
name="Negative"
313+
))
314+
315+
fig.show()
316+
```
317+
318+
By default, for shapes, legend items are disabled. Set `showlegend=True` on a shape for it to display a legend item.
319+
The name that appears for the shape in the legend is the shape's `name` if it is provided. If no `name` is provided, the shape label's `text` is used. If neither is provided, the legend item appears as "shape \<shape number>". For example, "shape 1".
257320

258321
```python
259322
import plotly.graph_objects as go
@@ -272,6 +335,15 @@ fig.add_trace(go.Scatter(
272335
name="Negative"
273336
))
274337

338+
fig.add_shape(
339+
showlegend=True,
340+
type="rect",
341+
x0=2,
342+
x1=4,
343+
y0=4.5,
344+
y1=5,
345+
)
346+
275347
fig.show()
276348
```
277349

@@ -324,7 +396,7 @@ fig.show()
324396

325397
#### Hiding the Trace Initially
326398

327-
Traces have a `visible` attribute. If set to `legendonly`, the trace is hidden from the graph implicitly. Click on the name in the legend to display the hidden trace.
399+
Traces and shapes have a `visible` attribute. If set to `legendonly`, the trace or shape is hidden from the graph implicitly. Click on the name in the legend to display the hidden trace or shape.
328400

329401
```python
330402
import plotly.graph_objects as go
@@ -578,7 +650,7 @@ fig.show()
578650

579651
*New in 5.15*
580652

581-
By default, all traces appear on one legend. To have multiple legends, specify an alternative legend for a trace using the `legend` property. For a second legend, set `legend="legend2"`. Specify more legends with `legend="legend3"`, `legend="legend4"` and so on.
653+
By default, all traces and shapes appear on one legend. To have multiple legends, specify an alternative legend for a trace or shape using the `legend` property. For a second legend, set `legend="legend2"`. Specify more legends with `legend="legend3"`, `legend="legend4"` and so on.
582654

583655
In this example, the last two scatter traces display on the second legend, "legend2". On the figure's layout, we then position and style each legend.
584656

Diff for: doc/python/lines-on-mapbox.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737

3838
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.
3939

40-
To draw a line on your map, you either can use [`px.line_mapbox()`](https://www.plotly.express/plotly_express/#plotly_express.line_mapbox) 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.
40+
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.
4141

4242
### Lines on Mapbox maps using Plotly Express
4343

@@ -132,5 +132,5 @@ fig.show()
132132

133133
#### Reference
134134

135-
See [function reference for `px.(line_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.line_mapbox) or
135+
See [function reference for `px.(line_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.line_mapbox) or
136136
https://plotly.com/python/reference/scattermapbox/ for more information about mapbox and their attribute options.

Diff for: doc/python/parallel-categories-diagram.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For other representations of multivariate data, also see [parallel coordinates](
4545

4646
This example visualizes the restaurant bills of a sample of 244 people. Hovering over a category rectangle (sex, smoker, etc) displays a tooltip with the number of people with that single trait. Hovering over a ribbon in the diagram displays a tooltip with the number of people with a particular combination of the five traits connected by the ribbon.
4747

48-
By default, `px.parallel_categories` will display any column in the `data_frame` that has a cardinality (or number of unique values) of less than 50. This can be overridden either by passing in a specific list of columns to `dimensions` or by setting `dimensions_max_cardinality` to something other than 50.
48+
By default, `px.parallel_categories` will display any column in the `data_frame` that has a cardinality (or number of unique values) of less than 50. This can be overridden either by passing in a specific list of columns to `dimensions` or by setting `dimensions_max_cardinality` to something other than 50.
4949

5050
```python
5151
import plotly.express as px
@@ -58,7 +58,7 @@ fig.show()
5858

5959
#### Style Diagram
6060

61-
In this example `dimensions` represents a list of stings or the columns of data frame, and `labels` is a dictionary with string keys (column name) and string values ('desired label to be displayed'). See [Plotly express reference page](https://www.plotly.express/plotly_express/#plotly_express.parallel_categories) for more information.
61+
In this example `dimensions` represents a list of stings or the columns of data frame, and `labels` is a dictionary with string keys (column name) and string values ('desired label to be displayed'). See [Plotly express reference page](https://plotly.com/python-api-reference/generated/plotly.express.parallel_categories) for more information.
6262

6363
```python
6464
import plotly.express as px

Diff for: doc/python/px-arguments.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fig.show()
170170

171171
### Input Data as Non-Pandas `DataFrame`s
172172

173-
**New in 5.15**
173+
*New in 5.15*
174174

175175
In the examples above, we've used Pandas DataFrames. You can also provide another type of DataFrame to the `data_frame` argument if that DataFrame has a `to_pandas` method, for example, a [Polars](https://www.pola.rs/) DataFrame.
176176

@@ -196,6 +196,13 @@ fig = px.bar(wide_df, x="nation", y=["gold", "silver", "bronze"], title="Wide-Fo
196196
fig.show()
197197
```
198198

199+
*New in 5.16*
200+
201+
As of version 5.16, you can also provide another type of DataFrame to the `data_frame` argument if that DataFrame supports the [Python dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/index.html), or has a `toPandas` or `to_pandas_df` method.
202+
203+
Even if the DataFrame that you are using supports the Python dataframe interchange protocol, you'll need to have Pandas version 2.0.3 or later installed. If you are using an earlier version of Pandas, Plotly Express will look for a `to_pandas`, `toPandas`, and `to_pandas_df` method, and use whichever one is available.
204+
205+
199206
### Input Data as array-like columns: NumPy arrays, lists...
200207

201208
`px` arguments can also be array-like objects such as lists, NumPy arrays, in both long-form or wide-form (for certain functions).

0 commit comments

Comments
 (0)