Skip to content

Commit 707ecbe

Browse files
Merge branch 'master' into doc-prod
2 parents e9ff176 + 6a06458 commit 707ecbe

File tree

88 files changed

+2812
-577
lines changed

Some content is hidden

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

88 files changed

+2812
-577
lines changed

CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
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+
## [4.8.0] - 2020-05-26
6+
7+
### Added
8+
9+
- `plotly` now provides a Plotly Express-backed Pandas-compatible plotting backend, which can be activated via `pandas.options.plotting.backend = "plotly"`. Note that it is not intended to implement every Pandas plotting function, nor is it intended to replicate the behaviour of every argument, although per the changes below, `x` and `y` should behave similarly. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
10+
- New datasets have been added to `plotly.express.data`: `stocks`, `experiment`, `medals_wide` and `medals_long`. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
11+
- plotly `go.Figure` and `go.FigureWidget` now have a `_repr_html_` and a `_repr_mimebundle_` method, which are [standard hooks for integration in systems based on IPython](https://ipython.readthedocs.io/en/stable/config/integrating.html). In particular, with `_repr_html_` plotly figures can now be used within [sphinx-gallery](https://sphinx-gallery.github.io/stable/index.html) without any scraper. These additions should not change anything to the way plotly figures are displayed in notebook environments, since the `_ipython_display_` method (already present in earlier versions) takes precedence over the new methods.
12+
13+
### Updated
14+
15+
- The behaviour of the `x`, `y`, `orientation`, `histfunc`, `violinmode`, `boxmode` and `stripmode` arguments for 2d-cartesian functions in Plotly Express (i.e. `scatter`, `line`, `area`, `bar`, `histogram`, `violin`, `box`, `strip`, `funnel`, `density_heatmap` and `density_contour`) has been refined ([#2336](https://github.com/plotly/plotly.py/pull/2336)):
16+
- if `x` or `y` is missing, it is inferred to be the index of `data_frame` if `data_frame` provided, otherwise a stable index of integers starting at 0. In the case of `px.bar`, if the provided value is not continuous, the missing value is treated as a column of 1s named "count", so as to behave more like `px.histogram` and to avoid sizing the resulting bars differently based on their position in the column. Previously, missing values defaulted to integers starting at 0 *per trace* which made it potentially inconsistent or misleading.
17+
- if `x` (`y`) is missing, `orientation` now defaults to `v` (`h`). Previously it always defaulted to `v` but this is not considered a breaking change, as the cases in which it now defaults to `h` caused unreadable output if set to `v`.
18+
- if both `x` and `y` are provided and one of them does not contain continuous values, `orientation` defaults to the value perpendicular to that axis. Previously it always defaulted to `v` but this is not considered a breaking change, as the cases in which it now defaults to `h` caused unreadable output if set to `v`.
19+
- if either `x` or `y` (but not both) may now be provided as a list of column references into `data_frame` or columns of data, in which case the imputed data frame will be treated as "wide" data and `melt()`ed internally before applying the usual mapping rules, with function-specific defaults.
20+
- if neither `x` nor `y` is provided but `data_frame` is, the data frame will be treated as "wide" with defaults depending on the value of `orientation` (and `orientation` has accordingly been added to `scatter`, `line`, `density_heatmap`, and `density_contour` for this purpose). Previously this would have resulted in an empty figure.
21+
- if both `x` and `y` are provided to `histogram`, and if `x`, `y` and `z` are provided to `density_heatmap` or `density_contour`, then `histfunc` now defaults to `sum` so as to avoid ignoring the provided data, and to cause `histogram` and `bar` to behave more similarly.
22+
- `violinmode`, `boxmode` and `stripmode` now default to `overlay` if `x` (`y`) in in `v` (`h`) orientation is also mapped to `color`, to avoid strange spacing issues with the previous default of `group` in all cases.
23+
- The Plotly Express arguments `color_discrete_map`, `symbol_map` and `line_dash_map` now accept the string `"identity"` which causes the corresponding input data to be used as-is rather than mapped into `color_discrete_sequence`, `symbol_sequence` or `line_dash_sequence`, respectively. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
24+
- Plotly Express now accepts `px.Constant` or `px.Range` objects in the place of column references so as to express constant or increasing integer values. ([#2336](https://github.com/plotly/plotly.py/pull/2336))
25+
26+
527
## [4.7.1] - 2020-05-08
628

729
### Fixed

README.md

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

3434
## Quickstart
3535

36-
`pip install plotly==4.7.1`
36+
`pip install plotly==4.8.0`
3737

3838
Inside [Jupyter notebook](https://jupyter.org/install) (installable with `pip install "notebook>=5.3" "ipywidgets>=7.2"`):
3939

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

8484
```
85-
pip install plotly==4.7.1
85+
pip install plotly==4.8.0
8686
```
8787

8888
or conda.
8989

9090
```
91-
conda install -c plotly plotly=4.7.1
91+
conda install -c plotly plotly=4.8.0
9292
```
9393

9494
### Jupyter Notebook Support
@@ -125,10 +125,10 @@ Then run the following commands to install the required JupyterLab extensions (n
125125

126126
```
127127
# Basic JupyterLab renderer support
128-
jupyter labextension install jupyterlab-plotly@4.7.1
128+
jupyter labextension install jupyterlab-plotly@4.8.0
129129
130130
# OPTIONAL: Jupyter widgets extension for FigureWidget support
131-
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.7.1
131+
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.8.0
132132
```
133133

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

binder/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
jupytext
2-
plotly==4.7.0
2+
plotly==4.8.0
33
jupyter
44
notebook
5-
pandas
5+
pandas==1.0.3
66
statsmodels==0.10.1
77
scipy
88
patsy==0.5.1

doc/apidoc/Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = python3 -m sphinx
6+
SPHINXBUILD = python -m sphinx
77
SOURCEDIR = .
88
BUILDDIR = _build
99

@@ -22,9 +22,13 @@ help:
2222
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py
2323
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py
2424
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py
25-
sphinx-apidoc -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
25+
cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/plotly/colors
26+
cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/plotly/express/colors
27+
sphinx-apidoc -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
2628
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2729
git checkout -- ../../packages/python/plotly/plotly/graph_objs
30+
rm ../../packages/python/plotly/plotly/colors/diverging.py ../../packages/python/plotly/plotly/colors/sequential.py ../../packages/python/plotly/plotly/colors/qualitative.py ../../packages/python/plotly/plotly/colors/cyclical.py
31+
rm ../../packages/python/plotly/plotly/express/colors/diverging.py ../../packages/python/plotly/plotly/express/colors/sequential.py ../../packages/python/plotly/plotly/express/colors/qualitative.py ../../packages/python/plotly/plotly/express/colors/cyclical.py
2832
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
2933
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
3034
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html

doc/apidoc/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Submodules
1717
* :ref:`Subplots: helper function for layout out multi-plot figures <subplots>`
1818
* :ref:`Figure Factories: helper methods for building specific complex charts <ff>`
1919
* :ref:`I/O: low-level interface for displaying, reading and writing figures <io>`
20+
* :mod:`plotly.colors`: colorscales and utility functions
21+
* :mod:`plotly.data`: built-in datasets for demonstration, educational and test purposes
2022

2123
Full reference list
2224
-------------------

doc/apidoc/plotly.express.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _px:
22

33
`plotly.express`: high-level interface for data visualization
4-
================================
4+
=============================================================
55

66
The `plotly.express <https://plot.ly/python/plotly-express/>`_ module is
77
plotly's high-level API for rapid figure generation. ::
@@ -49,4 +49,12 @@ plotly's high-level API for rapid figure generation. ::
4949
imshow
5050

5151

52+
`plotly.express` subpackages
53+
---------------------------
5254

55+
56+
.. toctree::
57+
:maxdepth: 1
58+
59+
generated/plotly.express.data.rst
60+
generated/plotly.express.colors.rst

doc/python/2D-Histogram.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A 2D histogram, also known as a density heatmap, is the 2-dimensional generaliza
4242

4343
## Density Heatmaps with Plotly Express
4444

45-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). The Plotly Express function `density_heatmap()` can be used to produce density heatmaps.
45+
[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/). The Plotly Express function `density_heatmap()` can be used to produce density heatmaps.
4646

4747
```python
4848
import plotly.express as px

doc/python/2d-histogram-contour.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A 2D histogram contour plot, also known as a density contour plot, is a 2-dimens
4040

4141
## Density Contours with Plotly Express
4242

43-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). The Plotly Express function `density_contour()` can be used to produce density contours.
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/). The Plotly Express function `density_contour()` can be used to produce density contours.
4444

4545
```python
4646
import plotly.express as px

doc/python/3d-scatter-plots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jupyter:
3535

3636
## 3D scatter plot with Plotly Express
3737

38-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
38+
[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/).
3939

4040
Like the [2D scatter plot](https://plotly.com/python/line-and-scatter/) `px.scatter`, the 3D function `px.scatter_3d` plots individual data in three-dimensional space.
4141

doc/python/bar-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jupyter:
3535

3636
### Bar chart with Plotly Express
3737

38-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
38+
[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/).
3939

4040
With `px.bar`, each row of the DataFrame is represented as a rectangular mark.
4141

doc/python/box-plots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A [box plot](https://en.wikipedia.org/wiki/Box_plot) is a statistical representa
4040

4141
## Box Plot with `plotly.express`
4242

43-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
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/).
4444

4545
In a box plot created by `px.box`, the distribution of the column given as `y` argument is represented.
4646

doc/python/bubble-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jupyter:
3838

3939
A [bubble chart](https://en.wikipedia.org/wiki/Bubble_chart) is a scatter plot in which a third dimension of the data is shown through the size of markers. For other types of scatter plot, see the [line and scatter page](https://plotly.com/python/line-and-scatter/).
4040

41-
We first show a bubble chart example using Plotly Express. [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). The size of markers is set from the dataframe column given as the `size` parameter.
41+
We first show a bubble chart example using Plotly Express. [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/). The size of markers is set from the dataframe column given as the `size` parameter.
4242

4343
```python
4444
import plotly.express as px

doc/python/bubble-maps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Plotly figures made with `px.scatter_geo`, `px.line_geo` or `px.choropleth` func
3939

4040
### Bubble map with Plotly Express
4141

42-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). With `px.scatter_geo`, each line of the dataframe is represented as a marker point. The column set as the `size` argument gives the size of markers.
42+
[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/). With `px.scatter_geo`, each line of the dataframe is represented as a marker point. The column set as the `size` argument gives the size of markers.
4343

4444
```python
4545
import plotly.express as px

doc/python/choropleth-maps.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The GeoJSON data is passed to the `geojson` argument, and the data is passed int
5656

5757
### Choropleth Map with plotly.express
5858

59-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
59+
[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/).
6060

6161
#### GeoJSON with `feature.id`
6262

@@ -208,7 +208,6 @@ fig.show()
208208
```python
209209
import plotly.graph_objects as go
210210

211-
# Load data frame and tidy it.
212211
import pandas as pd
213212
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv')
214213

0 commit comments

Comments
 (0)