Skip to content

Commit 495bc35

Browse files
authored
Merge branch 'master' into 3984-facets-empty-dataset
2 parents 7a14376 + 5b65329 commit 495bc35

File tree

363 files changed

+15896
-2625
lines changed

Some content is hidden

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

363 files changed

+15896
-2625
lines changed

Diff for: .circleci/config.yml

+166-57
Large diffs are not rendered by default.

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ doc/check-or-enforce-order.py
5252
packages/javascript/jupyterlab-plotly/lib/
5353
packages/python/plotly/jupyterlab_plotly/labextension/
5454
packages/python/plotly/jupyterlab_plotly/nbextension/index.js*
55+
56+
test/percy/*.html
57+
test/percy/pandas2/*.html

Diff for: CHANGELOG.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,51 @@
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-
## UNRELEASED
5+
## [UNRELEASED]
6+
7+
### Fixed
8+
- Fixed another compatibility issue with Pandas 2.0, just affecting `px.*(line_close=True)` [[#4190](https://github.com/plotly/plotly.py/pull/4190)]
9+
10+
## [5.14.1] - 2023-04-05
11+
12+
### Fixed
13+
- Fixed compatibility issue with Pandas 2.0 [[#4103](https://github.com/plotly/plotly.py/pull/4103)]
14+
15+
## [5.14.0] - 2023-03-29
16+
17+
### Updated
18+
- Updated Plotly.js to from version 2.18.2 to version 2.20.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2200----2023-03-15) for more information. Notable changes include:
19+
- Add `title.automargin` to enable automatic top and bottom margining for both container and paper referenced titles [[#6428](https://github.com/plotly/plotly.js/pull/6428)],
20+
with thanks to [Gamma Technologies](https://www.gtisoft.com/) for sponsoring the related development.
21+
- Add `label` attribute to shapes [[#6454](https://github.com/plotly/plotly.js/pull/6454)], with thanks to the [Volkswagen](https://www.volkswagenag.com) Center of Excellence for Battery Systems for sponsoring development!
22+
- Add `labelalias` to various axes namely cartesian, gl3d, polar, smith, ternary, carpet,
23+
indicator and colorbar [[#6481](https://github.com/plotly/plotly.js/pull/6481)],
24+
this feature was anonymously sponsored: thank you to our sponsor!
25+
- Key errors no longer precalculated when performing updates on plots [[#4101](https://github.com/plotly/plotly.py/pull/4101)]
26+
27+
### Fixed
28+
- Fixed an issue with characters displaying incorrectly, by adding `charset="utf-8"` to scripts in `to_html` [[#4114](https://github.com/plotly/plotly.py/pull/4114)]
29+
- Added `packaging` to install requirements, fixing a `No module named 'packaging` error on Python 3.6 [[#4113](https://github.com/plotly/plotly.py/pull/4113)]
30+
31+
### Added
32+
- Added option to allow passing a column name as a `str` in `hover_data` and `custom_data` in `plotly.express` [[4083](https://github.com/plotly/plotly.py/pull/4083)]
33+
34+
## [5.13.1] - 2023-02-24
35+
36+
### Updated
37+
- Updated Plotly.js to from version 2.18.0 to version 2.18.2. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2182----2023-02-15) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module.
38+
- Updated distutils.Version to packaging.Version [#3897](https://github.com/plotly/plotly.py/pull/3897)] and [#4055](https://github.com/plotly/plotly.py/pull/4055)]
39+
40+
## [5.13.0] - 2023-01-23
641

742
### Updated
843
- Updated Plotly.js to from version 2.17.1 to version 2.18.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2180----2023-01-19) for more information. Notable changes include:
944
- Add `sync` tickmode option [[#6356](https://github.com/plotly/plotly.js/pull/6356), [#6443](https://github.com/plotly/plotly.js/pull/6443)], with thanks to @filipesantiagoAM and @VictorBezak for the contribution!
45+
- Build process now uses Node 18.x and version 2 lockfile (should be an invisible change for users) [[#4034](https://github.com/plotly/plotly.py/pull/4034)]
46+
47+
### Fixed
48+
- `write_html()` now explicitly encodes output as UTF-8 because Plotly.js' bundle contains such characters [[#4021](https://github.com/plotly/plotly.py/pull/4021)] and [[#4022](https://github.com/plotly/plotly.py/pull/4022)]
49+
- fixed `iframe` renderer regression from 5.12 and also fixed error when this renderer was used in the very first cell in a notebook [[#4036](https://github.com/plotly/plotly.py/pull/4036)]
1050

1151

1252
## [5.12.0] - 2023-01-12

Diff for: README.md

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

3434
## Quickstart
3535

36-
`pip install plotly==5.12.0`
36+
`pip install plotly==5.14.1`
3737

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

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

8080
```
81-
pip install plotly==5.12.0
81+
pip install plotly==5.14.1
8282
```
8383

8484
or conda.
8585

8686
```
87-
conda install -c plotly plotly=5.12.0
87+
conda install -c plotly plotly=5.14.1
8888
```
8989

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

107107
```
108108
# JupyterLab 2.x renderer support
109-
jupyter labextension install jupyterlab-plotly@5.12.0 @jupyter-widgets/jupyterlab-manager
109+
jupyter labextension install jupyterlab-plotly@5.14.1 @jupyter-widgets/jupyterlab-manager
110110
```
111111

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

Diff for: SECURITY.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 5.x | :white_check_mark: |
8+
| < 5.0 | :x: |
9+
10+
## Reporting a Vulnerability
11+
12+
Please email [email protected] with any concerns about security.

Diff for: binder/requirements.txt

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

Diff for: contributing.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ 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 skip it,
1313
but the general idea is to be nice.
1414

1515
## What are the different ways to contribute?
1616

17-
There are many ways to contribute to plotly.py. It helps to understand first
18-
the structure of the code and of the repository.
17+
There are many ways to contribute to plotly.py. To contribute effectively, it is important to first gain an understanding of the structure of the code and of the repository.
1918

2019
- [the `plotly.graph_objects` module](https://plotly.com/python/graph-objects/) (usually imported as `go`)
2120
is [generated from the Plotly.js schema](https://plotly.com/python/figure-structure/),

Diff for: 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 = "5.12.0"
31+
release = "5.14.1"
3232

3333

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

Diff for: doc/python/aggregations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ import plotly.io as pio
144144

145145
import pandas as pd
146146

147-
df = pd.read_csv("https://plotly.com/~public.health/17.csv")
147+
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/US-shooting-incidents.csv")
148148

149149
data = [dict(
150150
x = df['date'],
@@ -191,7 +191,7 @@ layout = dict(
191191
method = 'restyle',
192192
), dict(
193193
args = ['xbins.size', 'M3'],
194-
label = 'Quater',
194+
label = 'Quarter',
195195
method = 'restyle',
196196
), dict(
197197
args = ['xbins.size', 'M6'],

Diff for: doc/python/axes.md

+19
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,25 @@ fig.update_yaxes(ticklabelposition="inside top", title=None)
154154
fig.show()
155155
```
156156

157+
#### Specifying Label Aliases
158+
159+
*New in 5.14*
160+
161+
With `labelalias`, you can specify replacement text for specific tick and hover labels. In this example, the dataset has the values of "Sat" and "Sun" in the day column. By setting `labelalias=dict(Sat="Saturday", Sun="Sunday")`, we swap these out for "Saturday" and "Sunday".
162+
163+
```python
164+
import plotly.express as px
165+
import pandas as pd
166+
167+
df = px.data.tips()
168+
df = df[df.day.isin(['Sat', 'Sun'])].groupby(by='day', as_index=False).sum(numeric_only=True)
169+
170+
fig = px.bar(df, x="day", y="total_bill")
171+
fig.update_xaxes(labelalias=dict(Sat="Saturday", Sun="Sunday"))
172+
173+
fig.show()
174+
```
175+
157176
##### Set axis title text with Graph Objects
158177

159178
Axis titles are set using the nested `title.text` property of the x or y axis. Here is an example of creating a new figure and using `update_xaxes` and `update_yaxes`, with magic underscore notation, to set the axis titles.

Diff for: doc/python/builtin-colorscales.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jupyter:
4141
Many Plotly Express functions accept a `color_continuous_scale` argument and many trace
4242
types have a `colorscale` attribute in their schema. Plotly comes with a large number of
4343
built-in continuous color scales, which can be referred to in Python code when setting the above arguments,
44-
either by name in a case-insensitive string e.g. `px.scatter(continuous_color_scale="Viridis"`) or by reference e.g.
44+
either by name in a case-insensitive string e.g. `px.scatter(color_continuous_scale="Viridis"`) or by reference e.g.
4545
`go.Scatter(marker_colorscale=plotly.colors.sequential.Viridis)`. They can also be reversed by adding `_r` at the end
4646
e.g. `"Viridis_r"` or `plotly.colors.sequential.Viridis_r`.
4747

Diff for: doc/python/colorscales.md

+38-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.14.5
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.8
23+
version: 3.10.9
2424
plotly:
2525
description: How to set, create and control continuous color scales and color
2626
bars in scatter, bar, map and heatmap figures.
@@ -298,6 +298,41 @@ fig.update_layout(coloraxis_colorbar=dict(
298298
fig.show()
299299
```
300300

301+
### Using Label Aliases on Colorbars
302+
303+
*New in 5.14*
304+
305+
Using `labelalias` you can replace some labels on the `colorbar` with alternative values. In this example, the `colorbar` has five `tickvals`. Using `labelalias`, instead of displaying all labels as the numbers in `tickvals`, we swap out three of the labels for text.
306+
307+
```python
308+
import plotly.graph_objects as go
309+
310+
import urllib
311+
import json
312+
313+
# Load heatmap data
314+
response = urllib.request.urlopen(
315+
"https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json")
316+
dataset = json.load(response)
317+
318+
# Create and show figure
319+
fig = go.Figure()
320+
321+
fig.add_trace(go.Heatmap(
322+
z=dataset["z"],
323+
colorbar=dict(
324+
title="Surface Heat",
325+
titleside="top",
326+
tickmode="array",
327+
tickvals=[2, 25, 50, 75, 100],
328+
labelalias={100: "Hot", 50: "Mild", 2: "Cold"},
329+
ticks="outside"
330+
)
331+
))
332+
333+
fig.show()
334+
```
335+
301336
### Custom Discretized Heatmap Color scale with Graph Objects
302337

303338
```python

Diff for: doc/python/dropdowns.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
9-
jupytext_version: 1.3.2
8+
format_version: '1.3'
9+
jupytext_version: 1.14.1
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.8.0
2424
plotly:
2525
description: How to add dropdowns to update Plotly chart attributes in Python.
2626
display_as: controls
@@ -362,26 +362,26 @@ fig = go.Figure()
362362
# Add Traces
363363

364364
fig.add_trace(
365-
go.Scatter(x=list(df.index),
365+
go.Scatter(x=list(df.Date),
366366
y=list(df.High),
367367
name="High",
368368
line=dict(color="#33CFA5")))
369369

370370
fig.add_trace(
371-
go.Scatter(x=list(df.index),
371+
go.Scatter(x=list(df.Date),
372372
y=[df.High.mean()] * len(df.index),
373373
name="High Average",
374374
visible=False,
375375
line=dict(color="#33CFA5", dash="dash")))
376376

377377
fig.add_trace(
378-
go.Scatter(x=list(df.index),
378+
go.Scatter(x=list(df.Date),
379379
y=list(df.Low),
380380
name="Low",
381381
line=dict(color="#F06A6A")))
382382

383383
fig.add_trace(
384-
go.Scatter(x=list(df.index),
384+
go.Scatter(x=list(df.Date),
385385
y=[df.Low.mean()] * len(df.index),
386386
name="Low Average",
387387
visible=False,
@@ -393,17 +393,17 @@ high_annotations = [dict(x="2016-03-01",
393393
xref="x", yref="y",
394394
text="High Average:<br> %.3f" % df.High.mean(),
395395
ax=0, ay=-40),
396-
dict(x=df.High.idxmax(),
396+
dict(x=df.Date[df.High.idxmax()],
397397
y=df.High.max(),
398398
xref="x", yref="y",
399399
text="High Max:<br> %.3f" % df.High.max(),
400-
ax=0, ay=-40)]
400+
ax=-40, ay=-40)]
401401
low_annotations = [dict(x="2015-05-01",
402402
y=df.Low.mean(),
403403
xref="x", yref="y",
404404
text="Low Average:<br> %.3f" % df.Low.mean(),
405405
ax=0, ay=40),
406-
dict(x=df.High.idxmin(),
406+
dict(x=df.Date[df.High.idxmin()],
407407
y=df.Low.min(),
408408
xref="x", yref="y",
409409
text="Low Min:<br> %.3f" % df.Low.min(),

0 commit comments

Comments
 (0)