Skip to content

Commit e7d8ddb

Browse files
Merge branch 'master' into dendrogram-key-error
2 parents 6bc5b41 + a3550e6 commit e7d8ddb

File tree

140 files changed

+7268
-2799
lines changed

Some content is hidden

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

140 files changed

+7268
-2799
lines changed

.circleci/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,15 @@ jobs:
440440
git push --force [email protected]:plotly/plotly.py-docs.git master:built
441441
rm -rf .git
442442
cd ../..
443+
cd build/ipynb
444+
git init
445+
git config user.name plotlydocbot
446+
git config user.email [email protected]
447+
git add *
448+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${CIRCLE_SHA1}"
449+
git push --force [email protected]:plotly/plotly.py-docs.git master:built_ipynb
450+
rm -rf .git
451+
cd ../..
443452
fi
444453
tar -zcf build/html.tgz build/html
445454
rm -rf build/html build/ipynb

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
plotly/_version.py export-subst
1+
packages/python/plotly/plotly/_version.py export-subst

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ below :-).
3333
- [ ] For a new feature, I have added documentation examples in an existing or
3434
new tutorial notebook (please see the doc checklist as well).
3535
- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
36+
- [ ] For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).
3637
3738
-->

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ node_modules/
3131

3232
# virtual envs
3333
vv
34-
venv
34+
venv*
3535

3636
# dist files
3737
build
@@ -46,4 +46,5 @@ temp-plot.html
4646
doc/python/.ipynb_checkpoints
4747
doc/python/.mapbox_token
4848
doc/.ipynb_checkpoints
49+
tags
4950
doc/check-or-enforce-order.py

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
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.13.0] - UNRELEASED
6+
7+
### Added
8+
9+
- `go.Figure` now has a `set_subplots` method to set subplots on an already
10+
existing figure.
11+
12+
13+
## [4.12.1] - UNRELEASED
14+
15+
16+
17+
## [4.12.0] - 2020-10-23
18+
19+
### Added
20+
21+
- For `add_trace`, `add_shape`, `add_annotation` and `add_layout_image`, the `row` and/or `col` argument now also accept the string `"all"`. `row="all"` adds the object to all the subplot rows and `col="all"` adds the object to all the subplot columns. ([#2840](https://github.com/plotly/plotly.py/pull/2840))
22+
- Shapes that reference the plot axes in one dimension and the data in another dimension can be added with the new `add_hline`, `add_vline`, `add_hrect`, `add_vrect` functions, which also support the `row="all"` and `col="all"` arguments. ([#2840](https://github.com/plotly/plotly.py/pull/2840))
23+
- The `add_trace`, `add_shape`, `add_annotation`, `add_layout_image`, `add_hline`, `add_vline`, `add_hrect`, `add_vrect` functions accept an argument `exclude_empty_subplots` which if `True`, only adds the object to subplots already containing traces or layout objects. This is useful in conjunction with the `row="all"` and `col="all"` arguments. ([#2840](https://github.com/plotly/plotly.py/pull/2840))
24+
- For all `go.Figure` functions accepting a selector argument (e.g., `select_traces`), this argument can now also be a function which is passed each relevant graph object (in the case of `select_traces`, it is passed every trace in the figure). For graph objects where this function returns true, the graph object is included in the selection. ([#2844](https://github.com/plotly/plotly.py/pull/2844))
25+
26+
### Updated
27+
28+
- Updated Plotly.js to version 1.57.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/v1.57.1/CHANGELOG.md) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module.
29+
530
## [4.11.0] - 2020-10-01
631

732
### Updated

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
</tr>
3232
</table>
3333

34+
## Data Science Workspaces
35+
36+
Our recommended IDE for Plotly’s Python graphing library is Dash Enterprise’s [Data Science Workspaces](https://plotly.com/dash/workspaces/), which has both Jupyter notebook and Python code file support.
37+
3438
## Quickstart
3539

36-
`pip install plotly==4.11.0`
40+
`pip install plotly==4.12.0`
3741

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

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

8488
```
85-
pip install plotly==4.11.0
89+
pip install plotly==4.12.0
8690
```
8791

8892
or conda.
8993

9094
```
91-
conda install -c plotly plotly=4.11.0
95+
conda install -c plotly plotly=4.12.0
9296
```
9397

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

126130
```
127131
# Basic JupyterLab renderer support
128-
jupyter labextension install jupyterlab-plotly@4.11.0
132+
jupyter labextension install jupyterlab-plotly@4.12.0
129133
130134
# OPTIONAL: Jupyter widgets extension for FigureWidget support
131-
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.11.0
135+
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.12.0
132136
```
133137

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

binder/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jupytext
2-
plotly==4.11.0
2+
plotly==4.12.0
33
jupyter
44
notebook
55
pandas==1.0.3
@@ -18,3 +18,4 @@ cufflinks==0.17.3
1818
kaleido
1919
scikit-learn
2020
umap-learn
21+
wget

doc/apidoc/conf.py

Lines changed: 1 addition & 1 deletion
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.11.0"
31+
release = "4.12.0"
3232

3333

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

doc/python/bar-charts.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,56 @@ fig = go.Figure(data=[go.Bar(
287287
fig.show()
288288
```
289289

290+
Bar charts with custom widths can be used to make mekko charts (also known as marimekko charts, mosaic plots, or variwide charts).
291+
292+
```python
293+
import plotly.graph_objects as go
294+
import numpy as np
295+
296+
labels = ["apples","oranges","pears","bananas"]
297+
widths = np.array([10,20,20,50])
298+
299+
data = {
300+
"South": [50,80,60,70],
301+
"North": [50,20,40,30]
302+
}
303+
304+
fig = go.Figure()
305+
for key in data:
306+
fig.add_trace(go.Bar(
307+
name=key,
308+
y=data[key],
309+
x=np.cumsum(widths)-widths,
310+
width=widths,
311+
offset=0,
312+
customdata=np.transpose([labels, widths*data[key]]),
313+
texttemplate="%{y} x %{width} =<br>%{customdata[1]}",
314+
textposition="inside",
315+
textangle=0,
316+
textfont_color="white",
317+
hovertemplate="<br>".join([
318+
"label: %{customdata[0]}",
319+
"width: %{width}",
320+
"height: %{y}",
321+
"area: %{customdata[1]}",
322+
])
323+
))
324+
325+
fig.update_xaxes(
326+
tickvals=np.cumsum(widths)-widths/2,
327+
ticktext= ["%s<br>%d" % (l, w) for l, w in zip(labels, widths)]
328+
)
329+
330+
fig.update_xaxes(range=[0,100])
331+
fig.update_yaxes(range=[0,100])
332+
333+
fig.update_layout(
334+
title_text="Marimekko Chart",
335+
barmode="stack",
336+
uniformtext=dict(mode="hide", minsize=10),
337+
)
338+
```
339+
290340
### Customizing Individual Bar Base
291341

292342
```python

doc/python/choropleth-maps.md

Lines changed: 21 additions & 4 deletions
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.1
9+
jupytext_version: 1.4.2
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.6.8
23+
version: 3.7.7
2424
plotly:
2525
description: How to make choropleth maps in Python with Plotly.
2626
display_as: maps
@@ -164,7 +164,25 @@ fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
164164
fig.show()
165165
```
166166

167-
<!-- #region -->
167+
### Using GeoPandas Data Frames
168+
169+
`px.choropleth` accepts the `geometry` of a [GeoPandas](https://geopandas.org/) data frame as the input to `geojson` if the `geometry` contains polygons.
170+
171+
```python
172+
import plotly.express as px
173+
import geopandas as gpd
174+
175+
geo_df = gpd.read_file(gpd.datasets.get_path('nybb')).to_crs("EPSG:4326")
176+
177+
fig = px.choropleth(geo_df,
178+
geojson=geo_df.geometry,
179+
locations=geo_df.index,
180+
color='Shape_Leng',
181+
hover_name="BoroName")
182+
fig.update_geos(fitbounds="locations", visible=False)
183+
fig.show()
184+
```
185+
168186

169187
### Using Built-in Country and State Geometries
170188

@@ -179,7 +197,6 @@ Plotly comes with two built-in geometries which do not require an external GeoJS
179197
180198
To use the built-in countries geometry, provide `locations` as [three-letter ISO country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3).
181199

182-
<!-- #endregion -->
183200

184201
```python
185202
import plotly.express as px

0 commit comments

Comments
 (0)