Skip to content

Commit 7d76853

Browse files
Merge branch 'master' into issue-2550
Merges most up-to-date master
2 parents 5df126f + 1db86d0 commit 7d76853

File tree

186 files changed

+4776
-1834
lines changed

Some content is hidden

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

186 files changed

+4776
-1834
lines changed

Diff for: CHANGELOG.md

+57-6
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,73 @@
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-
## Dev version
5+
## [4.8.2] - unreleased
6+
7+
### Fixed
8+
9+
- Fixed special cases with `px.sunburst` and `px.treemap` with `path` input ([#2524](https://github.com/plotly/plotly.py/pull/2524))
10+
11+
## [4.8.1] - 2020-05-28
12+
13+
### Fixed
14+
15+
- Fixed the accidental removal of some functions and submodules from `plotly.colors` and `plotly.express.colors`
16+
17+
## [4.8.0] - 2020-05-26
618

719
### Added
820

9-
- The `hover_data` parameter of `px` functions can now be a dictionary. This
10-
makes it possible to skip hover information for some arguments or to change
11-
the formatting of hover informatiom [#2377](https://github.com/plotly/plotly.py/pull/2377).
21+
- `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))
22+
- 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))
23+
- 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.
24+
25+
### Updated
26+
27+
- 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)):
28+
- 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.
29+
- 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`.
30+
- 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`.
31+
- 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.
32+
- 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.
33+
- 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.
34+
- `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.
35+
- 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))
36+
- 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))
37+
38+
39+
## [4.7.1] - 2020-05-08
40+
41+
### Fixed
42+
43+
- Fix `AttributeError: module 'plotly.graph_objs' has no attribute 'FigureWidget'` exception on `from plotly.graph_objs import *` when `ipywidgets` is not installed. Error also occurred when importing `plotly.figure_factor`. It is now possible to import `plotly.graph_objs.FigureWidget` when `ipywidgets` is not installed, and an informative `ImportError` exception will be raised in the `FigureWidget` constructor ([#2443](https://github.com/plotly/plotly.py/issues/2443), [#1111](https://github.com/plotly/plotly.py/issues/1111)).
44+
- Fix `TypeError: unhashable type: 'Template'` during `Figure` construction when `plotly.io.templates.default` is set to a `Template` object rather than a string.
45+
46+
47+
## [4.7.0] - 2020-05-06
48+
49+
### Updated
50+
51+
- Updated Plotly.js to version 1.54.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/v1.54.1/CHANGELOG.md) for more information. The main new feature of this version of Plotly.js is the possibility to draw layout shapes, using custom dragmodes and corresponding modebar buttons.
52+
- The sphinx-gallery scraper has been updated to work with different structures of galleries [#2149](https://github.com/plotly/plotly.py/pull/2419)
53+
54+
### Added
55+
56+
- The `hover_data` parameter of `px` functions can now be a dictionary. This makes it possible to skip hover information for some arguments or to change the formatting of hover informatiom [#2377](https://github.com/plotly/plotly.py/pull/2377).
57+
- It's now possible to build a development version of Plotly.py against the build artifacts from a non-`master` branch of Plotly.js, which makes for faster QA and development cycles [#2349](https://github.com/plotly/plotly.py/pull/2349). Thanks [@zouhairm](https://github.com/zouhairm) for this Pull Request!
58+
59+
### Fixed
60+
61+
- Plotly Express trendlines now handle missing data correctly [#2357](https://github.com/plotly/plotly.py/pull/2357)
1262

1363
### Performance
64+
1465
This version includes several performance improvements ([#2368](https://github.com/plotly/plotly.py/pull/2368), [#2403](https://github.com/plotly/plotly.py/pull/2403)).
15-
66+
1667
- Child graph objects (e.g. `figure.layout.xaxis`) are no longer created eagerly during graph object construction. Instead, they are created lazily the first time the property is accessed.
1768
- Property validation is now disabled for select internal operations.
1869
- When used with Python 3.7 and above, ploty.py now takes advantage of [PEP-562](https://www.python.org/dev/peps/pep-0562/) to perform submodule imports lazily. This dramatically improves import times.
1970

20-
## [4.6] - 2020-03-31
71+
## [4.6.0] - 2020-03-31
2172

2273
### Updated
2374

Diff for: README.md

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

3434
## Quickstart
3535

36-
`pip install plotly==4.6.0`
36+
`pip install plotly==4.8.1`
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.6.0
85+
pip install plotly==4.8.1
8686
```
8787

8888
or conda.
8989

9090
```
91-
conda install -c plotly plotly=4.6.0
91+
conda install -c plotly plotly=4.8.1
9292
```
9393

9494
### Jupyter Notebook Support
@@ -112,44 +112,27 @@ For use in JupyterLab, install the `jupyterlab` and `ipywidgets`
112112
packages using pip...
113113

114114
```
115-
pip install jupyterlab==1.2 "ipywidgets==7.5"
115+
pip install jupyterlab "ipywidgets==7.5"
116116
```
117117

118118
or conda.
119119

120120
```
121-
conda install jupyterlab=1.2
122-
conda install "ipywidgets=7.5"
121+
conda install jupyterlab "ipywidgets=7.5"
123122
```
124123

125124
Then run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
126125

127126
```
128-
# Avoid "JavaScript heap out of memory" errors during extension installation
129-
# (OS X/Linux)
130-
export NODE_OPTIONS=--max-old-space-size=4096
131-
# (Windows)
132-
set NODE_OPTIONS=--max-old-space-size=4096
127+
# Basic JupyterLab renderer support
128+
jupyter labextension install [email protected]
133129
134-
# Jupyter widgets extension
135-
jupyter labextension install @jupyter-widgets/[email protected] --no-build
136-
137-
# FigureWidget support
138-
jupyter labextension install [email protected] --no-build
139-
140-
# and jupyterlab renderer support
141-
jupyter labextension install [email protected] --no-build
142-
143-
# Build extensions (must be done to activate extensions since --no-build is used above)
144-
jupyter lab build
145-
146-
# Unset NODE_OPTIONS environment variable
147-
# (OS X/Linux)
148-
unset NODE_OPTIONS
149-
# (Windows)
150-
set NODE_OPTIONS=
130+
# OPTIONAL: Jupyter widgets extension for FigureWidget support
131+
jupyter labextension install @jupyter-widgets/jupyterlab-manager [email protected]
151132
```
152133

134+
Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
135+
153136
### Static Image Export
154137

155138
plotly.py supports static image export using the `to_image` and `write_image`

Diff for: binder/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
jupytext
2-
plotly==4.6.0
2+
plotly==4.8.1
33
jupyter
44
notebook
5-
pandas
6-
statsmodels==0.10.1
5+
pandas==1.0.3
6+
statsmodels==0.11.1
77
scipy
88
patsy==0.5.1
99
numpy

Diff for: contributing.md

+25-15
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,28 @@ conda activate plotly-dev
128128
[conda-env]: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands
129129
[virtualenv]: http://docs.python-guide.org/en/latest/dev/virtualenvs/
130130

131-
### Install requirements
132-
133-
$ pip install -r packages/python/plotly/requirements.txt
134-
$ pip install -r packages/python/plotly/optional-requirements.txt
135-
136-
### Editable install of plotly packages (install from source)
131+
### Install requirements - (Non-Windows)
132+
```bash
133+
(plotly_dev) $ pip install -r packages/python/plotly/requirements.txt
134+
(plotly_dev) $ pip install -r packages/python/plotly/optional-requirements.txt
135+
```
136+
### Install requirements - (Windows + Conda)
137+
Because Windows requires Visual Studio libraries to compile some of the optional dependencies, follow these steps to
138+
complete installation and avoid gdal-config errors.
137139

138-
$ pip install -e packages/python/plotly/
139-
$ pip install -e packages/python/chart-studio/
140-
$ pip install -e packages/python/plotly-geo/
140+
```bash
141+
(plotly_dev) $ pip install -r packages/python/plotly/requirements.txt
142+
(plotly_dev) $ conda install fiona
143+
(plotly_dev) $ pip install -r packages/python/plotly/optional-requirements.txt
144+
```
141145

142-
This will ensure that the installed packages link to your local development
146+
### Editable install of plotly packages
147+
```bash
148+
(plotly_dev) $ pip install -e packages/python/plotly/
149+
(plotly_dev) $ pip install -e packages/python/chart-studio/
150+
(plotly_dev) $ pip install -e packages/python/plotly-geo/
151+
```
152+
This will ensure that the installed packages links to your local development
143153
directory, meaning that all changes you make reflect directly in your
144154
environment (don't forget to restart the Jupyter kernel though!). For more
145155
information see the
@@ -152,11 +162,11 @@ documentation on _development mode_.
152162

153163
Run the following commands in your virtual environment to use the
154164
development version of `FigureWidget`,
155-
156-
$ jupyter nbextension enable --py widgetsnbextension
157-
$ jupyter nbextension install --py --symlink --sys-prefix plotlywidget
158-
$ jupyter nbextension enable --py --sys-prefix plotlywidget
159-
165+
```bash
166+
(plotly_dev) $ jupyter nbextension enable --py widgetsnbextension
167+
(plotly_dev) $ jupyter nbextension install --py --symlink --sys-prefix plotlywidget
168+
(plotly_dev) $ jupyter nbextension enable --py --sys-prefix plotlywidget
169+
```
160170
To make plotly plots show up in JupyterLab, you also need to [install the plotly jupyterlab extensions][plotly-jl].
161171

162172
[plotly-jl]: https://plot.ly/python/getting-started/#jupyterlab-support-python-35

Diff for: 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_utils/colors/colorbrewer.py ../../packages/python/plotly/_plotly_utils/colors/carto.py ../../packages/python/plotly/_plotly_utils/colors/cmocean.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_utils/colors/colorbrewer.py ../../packages/python/plotly/_plotly_utils/colors/carto.py ../../packages/python/plotly/_plotly_utils/colors/cmocean.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 ../../packages/python/plotly/plotly/colors/colorbrewer.py ../../packages/python/plotly/plotly/colors/carto.py ../../packages/python/plotly/plotly/colors/cmocean.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 ../../packages/python/plotly/plotly/express/colors/colorbrewer.py ../../packages/python/plotly/plotly/express/colors/carto.py ../../packages/python/plotly/plotly/express/colors/cmocean.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

Diff for: doc/apidoc/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
# -- Project information -----------------------------------------------------
2323

2424
project = ""
25-
copyright = "2019, plotly team"
26-
author = "plotly team"
25+
copyright = "2020, Plotly"
26+
author = "Plotly"
2727

2828
# The short X.Y version
2929
version = ""
3030
# The full version, including alpha/beta/rc tags
31-
release = "4.6.0"
31+
release = "4.8.1"
3232

3333

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

Diff for: 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
-------------------

Diff for: 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

Diff for: doc/apidoc/plotly.figure_factory.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
create_annotated_heatmap
1414
create_bullet
1515
create_candlestick
16+
create_choropleth
1617
create_dendrogram
1718
create_distplot
1819
create_facet_grid

Diff for: doc/apidoc/plotly.graph_objects.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Figure
1818
:toctree: generated/
1919
:template: class_figure.rst
2020

21-
Figure
21+
Figure
2222

2323

2424
Layout
@@ -31,7 +31,7 @@ Layout
3131
Layout
3232

3333

34-
Simple charts
34+
Simple Traces
3535
--------------
3636

3737
.. autosummary::
@@ -47,7 +47,7 @@ Simple charts
4747
Contour
4848
Table
4949

50-
Distributions
50+
Distribution Traces
5151
-------------
5252

5353
.. autosummary::
@@ -60,7 +60,7 @@ Distributions
6060
Histogram2d
6161
Histogram2dContour
6262

63-
Finance
63+
Finance Traces
6464
-------
6565

6666
.. autosummary::
@@ -74,7 +74,7 @@ Finance
7474
Funnelarea
7575
Indicator
7676

77-
3D
77+
3D Traces
7878
--
7979

8080
.. autosummary::
@@ -89,7 +89,7 @@ Finance
8989
Volume
9090
Isosurface
9191

92-
Maps
92+
Map Traces
9393
----
9494

9595
.. autosummary::
@@ -102,7 +102,7 @@ Maps
102102
Choroplethmapbox
103103
Densitymapbox
104104

105-
Specialized
105+
Specialized Traces
106106
-----------
107107

108108
.. autosummary::

0 commit comments

Comments
 (0)