Skip to content

Commit ba329de

Browse files
Merge branch 'master' into lazyload_plotly
2 parents 1c80d75 + 9465de3 commit ba329de

File tree

528 files changed

+25482
-18815
lines changed

Some content is hidden

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

528 files changed

+25482
-18815
lines changed

.circleci/config.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,8 @@ workflows:
504504
- python-2.7-optional
505505
- python-3.5-optional
506506
- python-3.6-optional
507-
# 3.7 optional disabled due to current shapely incompatibility
508-
# - python-3.7-optional
509-
- python-2.7-plot_ly
510-
- python-3.7-plot_ly:
511-
requires:
512-
- python-2.7-plot_ly
507+
- python-3.7-optional
508+
- python-3.7-plot_ly
513509
- python-2-7-orca
514510
- python-3-5-orca
515511
- python-3-7-orca

CHANGELOG.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,35 @@
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.6] - 2020-03-31
6+
7+
### Updated
8+
9+
- Updated Plotly.js to version 1.53.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/v1.53.0/CHANGELOG.md) for more information on the numerous new features and bug fixes of this release. The main features of the Plotly.js release are
10+
- Introduce range breaks on date axes (for example, to remove week-ends) via `layout.xaxis.rangebreaks`
11+
- Introduce a new unified x (or y) hovermode (`layout.hovermode="x unified"`), in which the hover box shows the information for all traces at a given x (or y) position
12+
- Add `node.customdata` and `link.customdata` to sankey traces
13+
- Updated [contributing notes](https://github.com/plotly/plotly.py/blob/master/contributing.md) for more explanations on how to contribute to plotly.py [#2290](https://github.com/plotly/plotly.py/pull/2290). Please give feedback on these notes!
14+
- Updated documentation examples [#2325](https://github.com/plotly/plotly.py/pull/2325), and to show how to color links in Sankey diagrams [#2291](https://github.com/plotly/plotly.py/pull/2291).
15+
- Special thanks to [@SylwiaOliwia2](https://github.com/SylwiaOliwia2) and [@dangercrow](https://github.com/dangercrow) for improving our documentation!
16+
17+
18+
### Added
19+
20+
- `px.imshow` now accepts [`xarray`](http://xarray.pydata.org/) inputs, with metadata being used for axis labels, hover and colorbar [#2166](https://github.com/plotly/plotly.py/pull/2166)
21+
22+
23+
### Fixed
24+
25+
- Fixed handling of `opacity` in `px.pie`, `px.funnel_area`, `px.density_mapbox`, `px.funnel` [#2317](https://github.com/plotly/plotly.py/pull/2317), with thanks to [@tvaucher](https://github.com/tvaucher) for the contribution!
26+
527
## [4.5.4] - 2020-03-11
628

729
### Updated
830

931
- The documentation of the API https://plot.ly/python-api-reference/ now
1032
documents the full API [#2243](https://github.com/plotly/plotly.py/pull/2243)
11-
- New documentation examples for facets [#2235](https://github.com/plotly/plotly.py/pull/2235), legend [#2227](https://github.com/plotly/plotly.py/pull/2227), subplots [#2226](https://github.com/plotly/plotly.py/pull/2226), axes [#2234](https://github.com/plotly/plotly.py/pull/2234) and histograms [#2242](https://github.com/plotly/plotly.py/pull/2242).
33+
- New documentation examples for facets [#2235](https://github.com/plotly/plotly.py/pull/2235), legend [#2227](https://github.com/plotly/plotly.py/pull/2227), subplots [#2226](https://github.com/plotly/plotly.py/pull/2226), axes [#2234](https://github.com/plotly/plotly.py/pull/2234) and histograms [#2242](https://github.com/plotly/plotly.py/pull/2242).
1234
Thanks to [@SylwiaOliwia2](https://github.com/@SylwiaOliwia2) for all these great
1335
examples!
1436

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<img src="https://img.shields.io/badge/help_forum-discourse-blue.svg"/>
1616
</td>
1717
</tr>
18-
1918
<tr>
2019
<td>PyPI Downloads</td>
2120
<td>
@@ -34,7 +33,7 @@
3433

3534
## Quickstart
3635

37-
`pip install plotly==4.5.4`
36+
`pip install plotly==4.6.0`
3837

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

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

8584
```
86-
pip install plotly==4.5.4
85+
pip install plotly==4.6.0
8786
```
8887

8988
or conda.
9089

9190
```
92-
conda install -c plotly plotly=4.5.4
91+
conda install -c plotly plotly=4.6.0
9392
```
9493

9594
### Jupyter Notebook Support
@@ -136,10 +135,10 @@ set NODE_OPTIONS=--max-old-space-size=4096
136135
jupyter labextension install @jupyter-widgets/[email protected] --no-build
137136
138137
# FigureWidget support
139-
jupyter labextension install plotlywidget@1.5.4 --no-build
138+
jupyter labextension install plotlywidget@4.6.0 --no-build
140139
141140
# and jupyterlab renderer support
142-
jupyter labextension install jupyterlab-plotly@1.5.4 --no-build
141+
jupyter labextension install jupyterlab-plotly@4.6.0 --no-build
143142
144143
# Build extensions (must be done to activate extensions since --no-build is used above)
145144
jupyter lab build

binder/requirements.txt

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

contributing.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Contributing
22

33
Thank you for contributing to plotly.py! We are actively looking for
4-
diverse contributors, with diverse background and skills.
4+
diverse contributors, with diverse background and skills.
55

66
This guide start by a general description of the different ways to contribute
77
to plotly.py, then we explain some technical aspects of preparing your
8-
contribution.
8+
contribution.
99

1010
## Code of Conduct
1111

12-
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't tl:dr; it,
12+
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't tl:dr; it,
1313
but the general idea is to be nice.
1414

1515
## What are the different ways to contribute?
@@ -37,7 +37,7 @@ the structure of the code and of the repository.
3737
- the `plotly.figure_factory` module provides Python "recipes" for building
3838
advanced visualizations, such as Gantt charts, annotated heatmaps, etc.
3939
Figure factories are one of the easiest entry points into plotly.py, since
40-
they consist of Python-only code, with standalone, well-separated functions.
40+
they consist of Python-only code, with standalone, well-separated functions.
4141
However, please note that some of the figure factories become less relevant
4242
as we are introducing more features into `plotly.express`. Some issues in the
4343
tracker are labeled "figure_factory" and can be good issues to work on. More
@@ -70,14 +70,14 @@ also contribute to the project by
7070
- reporting bugs (see below).
7171

7272
- submitting feature requests (maybe we'll convince you to contribute it as a
73-
pull request!).
73+
pull request!).
7474

7575
- helping other users on the [community forum](https://community.plot.ly/).
7676
Join the list of [nice people](https://community.plot.ly/u) helping other
7777
plotly users :-).
7878

7979
We also recommend reading the great
80-
[how to contribute to open source](https://opensource.guide/how-to-contribute/)
80+
[how to contribute to open source](https://opensource.guide/how-to-contribute/)
8181
guide.
8282

8383
## Have a Bug Report?
@@ -98,7 +98,7 @@ Below we explain the technical aspects of contributing. It is not strictly neces
9898

9999
Note that if you are modifying a single documentation page, you can do it
100100
directly on Github by clicking on the "Edit this page on GitHub" link, without
101-
cloning the repository.
101+
cloning the repository.
102102

103103
## Setup a Development Environment
104104

@@ -206,6 +206,7 @@ First update the version of the `plotly.js` dependency in `packages/javascript/p
206206
Then run the `updateplotlyjs` command with:
207207

208208
```bash
209+
$ cd packages/python/plotly
209210
$ python setup.py updateplotlyjs
210211
```
211212

@@ -214,6 +215,13 @@ the `plotly/plotly.js` GitHub repository (and place them in
214215
`plotly/package_data`). It will then regenerate all of the `graph_objs`
215216
classes based on the new schema.
216217

218+
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. For example, to update to a version from a pull request to the `plotly/plotly.js` repo that is numbered 555, run:
219+
220+
```bash
221+
$ cd packages/python/plotly
222+
$ python setup.py updateplotlyjsdev --devbranch pull/555
223+
```
224+
217225
## Testing
218226

219227
We take advantage of two tools to run tests:

doc/apidoc/_static/plotly-style.css

+22
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,25 @@ code {
3636
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus {
3737
background: lightgrey;
3838
}
39+
40+
dt {
41+
font-weight: normal;
42+
}
43+
44+
dd {
45+
margin-left: 20px;
46+
}
47+
48+
blockquote {
49+
font-size: 15px;
50+
border-left: none;
51+
}
52+
53+
li {
54+
margin-top: 8px;
55+
margin-bottom: 8px;
56+
}
57+
58+
code {
59+
background-color: #F5F5F5
60+
}

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 = "4.5.4"
31+
release = "4.6.0"
3232

3333

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

doc/python/2D-Histogram.md

+68-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.2'
9-
jupytext_version: 1.3.0
9+
jupytext_version: 1.3.1
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.5
23+
version: 3.6.8
2424
plotly:
2525
description: How to make 2D Histograms in Python with Plotly.
2626
display_as: statistical
@@ -30,9 +30,75 @@ jupyter:
3030
order: 6
3131
page_type: u-guide
3232
permalink: python/2D-Histogram/
33+
redirect_from:
34+
- python/2d-histogram/
35+
- python/2d-histograms/
3336
thumbnail: thumbnail/histogram2d.jpg
3437
---
3538

39+
## 2D Histograms or Density Heatmaps
40+
41+
A 2D histogram, also known as a density heatmap, is the 2-dimensional generalization of a [histogram](/python/histograms/) which resembles a [heatmap](/python/heatmaps/) but is computed by grouping a set of points specified by their `x` and `y` coordinates into bins, and applying an aggregation function such as `count` or `sum` (if `z` is provided) to compute the color of the tile representing the bin. This kind of visualization (and the related [2D histogram contour, or density contour](https://plotly.com/python/2d-histogram-contour/)) is often used to manage over-plotting, or situations where showing large data sets as [scatter plots](/python/line-and-scatter/) would result in points overlapping each other and hiding patterns. For data sets of more than a few thousand points, a better approach than the ones listed here would be to [use Plotly with Datashader](/python/datashader/) to precompute the aggregations before displaying the data with Plotly.
42+
43+
## Density Heatmaps with Plotly Express
44+
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.
46+
47+
```python
48+
import plotly.express as px
49+
df = px.data.tips()
50+
51+
fig = px.density_heatmap(df, x="total_bill", y="tip")
52+
fig.show()
53+
```
54+
55+
The number of bins can be controlled with `nbinsx` and `nbinsy` and the [color scale](/python/colorscales/) with `color_continuous_scale`.
56+
57+
```python
58+
import plotly.express as px
59+
df = px.data.tips()
60+
61+
fig = px.density_heatmap(df, x="total_bill", y="tip", nbinsx=20, nbinsy=20, color_continuous_scale="Viridis")
62+
fig.show()
63+
```
64+
65+
Marginal plots can be added to visualize the 1-dimensional distributions of the two variables. Here we use a marginal [`histogram`](/python/histograms/). Other allowable values are `violin`, `box` and `rug`.
66+
67+
```python
68+
import plotly.express as px
69+
df = px.data.tips()
70+
71+
fig = px.density_heatmap(df, x="total_bill", y="tip", marginal_x="histogram", marginal_y="histogram")
72+
fig.show()
73+
```
74+
75+
Density heatmaps can also be [faceted](/python/facet-plots/):
76+
77+
```python
78+
import plotly.express as px
79+
df = px.data.tips()
80+
81+
fig = px.density_heatmap(df, x="total_bill", y="tip", facet_row="sex", facet_col="smoker")
82+
fig.show()
83+
```
84+
85+
### Other aggregation functions than `count`
86+
87+
By passing in a `z` value and a `histfunc`, density heatmaps can perform basic aggregation operations. Here we show average Sepal Length grouped by Petal Length and Petal Width for the Iris dataset.
88+
89+
```python
90+
import plotly.express as px
91+
df = px.data.iris()
92+
93+
fig = px.density_heatmap(df, x="petal_length", y="petal_width", z="sepal_length", histfunc="avg")
94+
fig.show()
95+
```
96+
97+
### 2D Histograms with Graph Objects
98+
99+
To build this kind of plot without using Plotly Express, we can use the `go.Histogram2d` class.
100+
101+
36102
### 2D Histogram of a Bivariate Normal Distribution ###
37103

38104
```python

0 commit comments

Comments
 (0)