Skip to content

Commit

Permalink
Merge pull request #4321 from plotly/update-production-docs
Browse files Browse the repository at this point in the history
Update doc-prod docs with new release docs
  • Loading branch information
LiamConnors authored Aug 11, 2023
2 parents 851dcc3 + feb50c9 commit 3b561c2
Show file tree
Hide file tree
Showing 302 changed files with 6,487 additions and 2,370 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


## UNRELEASED
## [5.16.0] - 2023-08-11

### Updated
- 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.
- 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:
- Add "Equal Earth" projection to geo subplots [[#6670](https://github.com/plotly/plotly.js/pull/6670)],
with thanks to @apparebit for the contribution!
- Add options to include legends for shapes and `newshape` [[#6653](https://github.com/plotly/plotly.js/pull/6653)]
- `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.
- `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.

### Fixed
- Fixed Pandas performance warning issue caused by multiple `frame.insert` [[#4246](https://github.com/plotly/plotly.py/pull/4246)]

## [5.15.0] - 2023-06-08

Expand All @@ -23,7 +30,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
this feature was anonymously sponsored: thank you to our sponsor!
- 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.
- 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.
- `px` methods now accept data-frame-like objects that support a `to_pandas()` method, such as polars, cudf, vaex etc
- `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)]

### Fixed
- Fixed another compatibility issue with Pandas 2.0, just affecting `px.*(line_close=True)` [[#4190](https://github.com/plotly/plotly.py/pull/4190)]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## Quickstart

`pip install plotly==5.15.0`
`pip install plotly==5.16.0`

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

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

```
pip install plotly==5.15.0
pip install plotly==5.16.0
```

or conda.

```
conda install -c plotly plotly=5.15.0
conda install -c plotly plotly=5.16.0
```

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.15.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.16.0 @jupyter-widgets/jupyterlab-manager
```

Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
Expand Down
2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jupytext
plotly==5.15.0
plotly==5.16.0
jupyter
notebook
pandas==1.0.3
Expand Down
2 changes: 1 addition & 1 deletion doc/apidoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "5.15.0"
release = "5.16.0"


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jupyter:
thumbnail: thumbnail/axes.png
---

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/).
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/).

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

Expand Down Expand Up @@ -154,7 +154,7 @@ fig.update_yaxes(ticklabelposition="inside top", title=None)
fig.show()
```

#### Specifying Label Aliases
#### Specifying Label Aliases

*New in 5.14*

Expand Down
4 changes: 2 additions & 2 deletions doc/python/colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.5
jupytext_version: 1.14.6
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.10.11
version: 3.10.8
plotly:
description: How to set, create and control continuous color scales and color
bars in scatter, bar, map and heatmap figures.
Expand Down
6 changes: 3 additions & 3 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
`plotly` may be installed using `pip`:

```
$ pip install plotly==5.15.0
$ pip install plotly==5.16.0
```

or `conda`:

```
$ conda install -c plotly plotly=5.15.0
$ conda install -c plotly plotly=5.16.0
```
This package contains everything you need to write figures to standalone HTML files.

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.15.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.16.0 @jupyter-widgets/jupyterlab-manager
```

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.
Expand Down
98 changes: 85 additions & 13 deletions doc/python/legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.6
jupytext_version: 1.14.7
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.10.11
version: 3.10.4
plotly:
description: How to configure and style the legend in Plotly with Python.
display_as: file_settings
Expand All @@ -35,7 +35,7 @@ jupyter:

### Trace Types, Legends and Color Bars

[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.
[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.

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.

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

*New in v5.0*
*New in 5.16*

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.
If you have shapes that are configured to appear in a legend, these are displayed after all traces:

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.
```python
import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1, 2]))
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2, 1]))
fig.add_shape(
name="first shape",
showlegend=True,
type="rect",
xref="paper",
line=dict(dash="dash"),
x0=0.85,
x1=0.95,
y0=0,
y1=1.5,
)
fig.add_trace(go.Bar(name="third", x=["a", "b"], y=[1, 2]))
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2, 1]))

fig.show()

```

The `legendrank` attribute of a trace or shape can be used to control its placement in the legend.
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.

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.

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.

```python
import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2,1], legendrank=4))
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2,1], legendrank=2))
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1,2], legendrank=1))
fig.add_trace(go.Bar(name="fourth", x=["a", "b"], y=[2,1], legendrank=5))
fig.add_trace(go.Bar(name="second", x=["a", "b"], y=[2,1], legendrank=4))
fig.add_trace(go.Bar(name="first", x=["a", "b"], y=[1,2], legendrank=2))
fig.add_trace(go.Bar(name="third", x=["a", "b"], y=[1,2], legendrank=3))
fig.add_shape(
legendrank=1,
showlegend=True,
type="line",
xref="paper",
line=dict(dash="5px"),
x0=0.05,
x1=0.45,
y0=1.5,
y1=1.5,
)
fig.show()
```

#### Showing and Hiding the Legend

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

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

#### Legend Item Names

Legend items appear per trace, and the legend item name is taken from the trace's `name` attribute.
For traces, legend items appear per trace, and the legend item name is taken from the trace's `name` attribute.

```python
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[1, 2, 3, 4, 5],
name="Positive"
))

fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[5, 4, 3, 2, 1],
name="Negative"
))

fig.show()
```

By default, for shapes, legend items are disabled. Set `showlegend=True` on a shape for it to display a legend item.
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".

```python
import plotly.graph_objects as go
Expand All @@ -272,6 +335,15 @@ fig.add_trace(go.Scatter(
name="Negative"
))

fig.add_shape(
showlegend=True,
type="rect",
x0=2,
x1=4,
y0=4.5,
y1=5,
)

fig.show()
```

Expand Down Expand Up @@ -324,7 +396,7 @@ fig.show()

#### Hiding the Trace Initially

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

```python
import plotly.graph_objects as go
Expand Down Expand Up @@ -578,7 +650,7 @@ fig.show()

*New in 5.15*

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

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.

Expand Down
4 changes: 2 additions & 2 deletions doc/python/lines-on-mapbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jupyter:

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://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.
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.

### Lines on Mapbox maps using Plotly Express

Expand Down Expand Up @@ -132,5 +132,5 @@ fig.show()

#### Reference

See [function reference for `px.(line_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.line_mapbox) or
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/ for more information about mapbox and their attribute options.
4 changes: 2 additions & 2 deletions doc/python/parallel-categories-diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For other representations of multivariate data, also see [parallel coordinates](

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.

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

```python
import plotly.express as px
Expand All @@ -58,7 +58,7 @@ fig.show()

#### Style Diagram

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

```python
import plotly.express as px
Expand Down
9 changes: 8 additions & 1 deletion doc/python/px-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fig.show()

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

**New in 5.15**
*New in 5.15*

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.

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

*New in 5.16*

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.

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.


### Input Data as array-like columns: NumPy arrays, lists...

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

0 comments on commit 3b561c2

Please sign in to comment.