Skip to content

Commit 99ebbbc

Browse files
authored
Merge branch 'master' into pass-b64
2 parents 0323215 + 241746e commit 99ebbbc

File tree

2,239 files changed

+78786
-1170
lines changed

Some content is hidden

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

2,239 files changed

+78786
-1170
lines changed

.circleci/config.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ jobs:
374374

375375
full_build:
376376
docker:
377-
- image: continuumio/miniconda3
377+
- image: continuumio/miniconda3:24.3.0-0
378378
environment:
379379
LANG: en_US.UTF-8
380380
resource_class: large
@@ -447,8 +447,8 @@ jobs:
447447
resource_class: xlarge
448448
docker:
449449
# specify the version you desire here
450-
# use `-browsers` prefix for selenium tests, for example, `3.6.1-browsers`
451-
- image: cimg/python:3.9-browsers
450+
# use `-browsers` prefix for selenium tests, for example, `3.9-browsers`
451+
- image: cimg/python:3.10-browsers
452452

453453
steps:
454454
- add_ssh_keys:
@@ -599,3 +599,4 @@ workflows:
599599
- python_38_orca
600600
- python_39_percy
601601
- build-doc
602+

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
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+
## [5.23.0] - TBD
6+
7+
### Updated
8+
- Specify Python version 3.8-3.11 for development virtual environments and pin `pytest` at version 8.1.1 to match.
9+
- Update `IntegerValidator` to handle `extras` option to allow supporting additional keyword values. For example, 'bold' and 'normal' as well as integers as used in font weights [#4612].
10+
11+
## [5.22.0] - 2024-05-01
12+
13+
### Updated
14+
- Updated Plotly.js from version 2.31.1 to version 2.32.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2320----2024-04-23) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
15+
- Add "bold" weight, "italic" style and "small-caps" variant options to fonts [#6956]
16+
- Fix applying autotickangles on axes with showdividers as well as cases where tickson is set to "boundaries" [#6967], with thanks to @my-tien for the contribution!
17+
- Fix positioning of multi-line axis titles with standoff [#6970], with thanks to @my-tien for the contribution!
18+
19+
## [5.21.0] - 2024-04-17
20+
21+
### Updated
22+
- Updated Plotly.js from version 2.30.0 to version 2.31.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2311----2024-04-15) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
23+
- Add `zorder` attribute to various cartesian traces for controlling stacking order of SVG traces drawn into a subplot [[#6918](https://github.com/plotly/plotly.js/pull/6918), [#6953](https://github.com/plotly/plotly.js/pull/6953)],
24+
This feature was anonymously sponsored: thank you to our sponsor!
25+
- Add "between" option to shape layer for placing them above grid lines and below traces [[#6927](https://github.com/plotly/plotly.js/pull/6927)],
26+
with thanks to @my-tien for the contribution!
27+
- Add "raw" `sizemode` to cone trace [[#6938](https://github.com/plotly/plotly.js/pull/6938)]
28+
- Add `layout.hoversubplots` to enable hover effects across multiple cartesian suplots sharing one axis [[#6947](https://github.com/plotly/plotly.js/pull/6947), [#6950](https://github.com/plotly/plotly.js/pull/6950)]
29+
30+
### Fixed
31+
- Fixed `orjson` loading issue [[#4562](https://github.com/plotly/plotly.py/pull/4562)]
32+
533
## [5.20.0] - 2024-03-13
634

735
### Updated

README.md

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

34+
<div align="center">
35+
<a href="https://dash.plotly.com/project-maintenance">
36+
<img src="https://dash.plotly.com/assets/images/maintained-by-plotly.png" width="400px" alt="Maintained by Plotly">
37+
</a>
38+
</div>
39+
40+
3441
## Quickstart
3542

36-
`pip install plotly==5.20.0`
43+
`pip install plotly==5.22.0`
3744

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

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

8087
```
81-
pip install plotly==5.20.0
88+
pip install plotly==5.22.0
8289
```
8390

8491
or conda.
8592

8693
```
87-
conda install -c plotly plotly=5.20.0
94+
conda install -c plotly plotly=5.22.0
8895
```
8996

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

107114
```
108115
# JupyterLab 2.x renderer support
109-
jupyter labextension install jupyterlab-plotly@5.20.0 @jupyter-widgets/jupyterlab-manager
116+
jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager
110117
```
111118

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

binder/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
jupytext
2-
plotly==5.20.0
2+
plotly==5.22.0
33
jupyter
44
notebook
5-
pandas==1.2.0
6-
statsmodels==0.12.1
5+
pandas==2.2.2
6+
statsmodels==0.14.2
77
scipy
8-
patsy==0.5.1
8+
patsy==0.5.6
99
numpy
1010
plotly-geo
1111
psutil

contributing.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@ learn and become confident about git, like http://try.github.io/.
125125

126126
### Create a virtual environment for plotly development
127127

128-
You can use either [conda][conda-env] or [virtualenv][virtualenv] to create a virtual environment for plotly development, e.g.
128+
You can use either [conda][conda-env] or [virtualenv][virtualenv] to create a virtual environment for plotly development, e.g.:
129129

130130
```bash
131-
conda create -n plotly-dev python
131+
conda create -n plotly-dev python=3.11
132132
conda activate plotly-dev
133133
```
134134

135+
As of May 2024 our dependencies have been tested against Python versions 3.8 to 3.11.
136+
We will support Python 3.12 and higher versions soon.
137+
135138
[conda-env]: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands
136139
[virtualenv]: http://docs.python-guide.org/en/latest/dev/virtualenvs/
137140

doc/apidoc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ""
2828
# The full version, including alpha/beta/rc tags
29-
release = "5.20.0"
29+
release = "5.22.0"
3030

3131

3232
# -- General configuration ---------------------------------------------------

doc/python/3d-volume.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ np.random.seed(0)
8686
l = 30
8787
X, Y, Z = np.mgrid[:l, :l, :l]
8888
vol = np.zeros((l, l, l))
89-
pts = (l * np.random.rand(3, 15)).astype(np.int)
89+
pts = (l * np.random.rand(3, 15)).astype(int)
9090
vol[tuple(indices for indices in pts)] = 1
9191
from scipy import ndimage
9292
vol = ndimage.gaussian_filter(vol, 4)

doc/python/axes.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ fig.show()
367367

368368
*New in 5.19*
369369

370-
If `tickangle` is not explicitly set, its default value is `auto`, meaning if the label needs to be rotated to avoid labels overlapping, it will rotate by either 30 or 90 degrees. Using `autotickangles`, you can also specify a list of angles for `tickangle` to use. If `tickangle` is `auto` and you provide a list of angles to `autotickangles`, the label angle will be set to the first value in the list that prevents overlap.
370+
If `tickangle` is not explicitly set, its default value is `auto`, meaning if the label needs to be rotated to avoid labels overlapping, it will rotate by either 30 or 90 degrees. Using `autotickangles`, you can also specify a list of angles for `tickangle` to use. If `tickangle` is `auto` and you provide a list of angles to `autotickangles`, the label angle will be set to the first value in the list that prevents overlap.
371371

372372
```python
373373
import plotly.express as px
@@ -390,14 +390,18 @@ Here is an example.
390390
import plotly.graph_objects as go
391391
import pandas as pd
392392

393-
# Load and filter Apple stock data for 2016
394393
apple_df = pd.read_csv(
395-
"https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv",
396-
parse_dates=["Date"],
397-
index_col="Date"
394+
"https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv"
398395
)
399396

400-
apple_df_2016 = apple_df["2016"]
397+
# Convert 'Date' column to datetime format
398+
apple_df['Date'] = pd.to_datetime(apple_df['Date'])
399+
400+
# Set 'Date' column as index
401+
apple_df.set_index('Date', inplace=True)
402+
403+
# Filter for 2016
404+
apple_df_2016 = apple_df.loc['2016']
401405

402406
# Create figure and add line
403407
fig = go.Figure()
@@ -599,7 +603,7 @@ fig.show()
599603

600604
*New in 5.17*
601605

602-
You can also set just a lower or upper bound manually and have autorange applied to the other bound by setting it to `None`. In the following example, we set a an upper bound of 4.5 on the x axes, while specifying `None` for the lower bound, meaning it will use autorange. On the y axes, we set the lower bound, and use `None` for the upper bound, meaning that uses autorange.
606+
You can also set just a lower or upper bound manually and have autorange applied to the other bound by setting it to `None`. In the following example, we set a an upper bound of 4.5 on the x axes, while specifying `None` for the lower bound, meaning it will use autorange. On the y axes, we set the lower bound, and use `None` for the upper bound, meaning that uses autorange.
603607

604608
```python
605609
import plotly.express as px
@@ -857,7 +861,7 @@ fig.show()
857861

858862
#### <code>nonnegative</code>, <code>tozero</code>, and <code>normal</code> Rangemode
859863

860-
When you don't specify a range, autorange is used. It's also used for bounds set to `None` when providing a `range`.
864+
When you don't specify a range, autorange is used. It's also used for bounds set to `None` when providing a `range`.
861865

862866
The axis auto-range calculation logic can be configured using the `rangemode` axis parameter.
863867

@@ -898,7 +902,7 @@ fig.update_xaxes(autorangeoptions=dict(maxallowed=5))
898902
fig.show()
899903
```
900904

901-
##### Clip Minimum and Maximum
905+
##### Clip Minimum and Maximum
902906

903907
You can also clip an axis range at a specific maximum or minimum value with `autorangeoptions.clipmax` and `autorangeoptions.clipmin`.
904908

@@ -916,7 +920,7 @@ fig.show()
916920

917921
##### Specify Values to be Included
918922

919-
Use `autorangeoptions.include` to specify a value that should always be included within the calculated autorange. In this example, we specify that for the autorange calculated on the x-axis, 5 should be included.
923+
Use `autorangeoptions.include` to specify a value that should always be included within the calculated autorange. In this example, we specify that for the autorange calculated on the x-axis, 5 should be included.
920924

921925
```python
922926
import plotly.express as px

doc/python/bar-charts.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,56 @@ fig.update_layout(barmode='stack')
304304
fig.show()
305305
```
306306

307+
### Stacked Bar Chart From Aggregating a DataFrame
308+
309+
Stacked bar charts are a powerful way to present results summarizing categories generated using the Pandas aggregate commands. `pandas.DataFrame.agg` produces a wide data set format incompatible with `px.bar`. Transposing and updating the indexes to achieve `px.bar` compatibility is a somewhat involved option. Here is one straightforward alternative, which presents the aggregated data as a stacked bar using plotly.graph_objects.
310+
311+
```python
312+
from plotly import graph_objects as go
313+
import pandas as pd
314+
315+
# Get one year of gapminder data
316+
url = 'https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv'
317+
df = pd.read_csv(url)
318+
df = df[df['year']==2007]
319+
df["gdp"]=df["pop"]*df['gdpPercap']
320+
321+
322+
# Build the summary of interest
323+
df_summarized = df.groupby("continent", observed=True).agg("sum").reset_index()
324+
325+
df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summarized["pop"].sum()
326+
df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum()
327+
328+
329+
df = df_summarized[["continent",
330+
"percent of world population",
331+
"percent of world GDP",
332+
]]
333+
334+
# We now have a wide data frame, but it's in the opposite orientation from the one that px is designed to deal with.
335+
# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct.
336+
337+
fig=go.Figure()
338+
for category in df_summarized["continent"].values:
339+
fig.add_trace(go.Bar(
340+
x=df.columns[1:],
341+
# We need to get a pandas series that contains just the values to graph;
342+
# We do so by selecting the right row, selecting the right columns
343+
# and then transposing and using iloc to convert to a series
344+
# Here, we assume that the bar element category variable is in column 0
345+
y=list(df.loc[df["continent"]==category][list(df.columns[1:])].transpose().iloc[:,0]),
346+
name=str(category)
347+
348+
349+
)
350+
)
351+
fig.update_layout(barmode="stack")
352+
353+
fig.show()
354+
```
355+
356+
307357
### Bar Chart with Hover Text
308358

309359
```python

doc/python/box-plots.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,12 @@ x_data = ['Carmelo Anthony', 'Dwyane Wade',
458458

459459
N = 50
460460

461-
y0 = (10 * np.random.randn(N) + 30).astype(np.int)
462-
y1 = (13 * np.random.randn(N) + 38).astype(np.int)
463-
y2 = (11 * np.random.randn(N) + 33).astype(np.int)
464-
y3 = (9 * np.random.randn(N) + 36).astype(np.int)
465-
y4 = (15 * np.random.randn(N) + 31).astype(np.int)
466-
y5 = (12 * np.random.randn(N) + 40).astype(np.int)
461+
y0 = (10 * np.random.randn(N) + 30).astype(int)
462+
y1 = (13 * np.random.randn(N) + 38).astype(int)
463+
y2 = (11 * np.random.randn(N) + 33).astype(int)
464+
y3 = (9 * np.random.randn(N) + 36).astype(int)
465+
y4 = (15 * np.random.randn(N) + 31).astype(int)
466+
y5 = (12 * np.random.randn(N) + 40).astype(int)
467467

468468
y_data = [y0, y1, y2, y3, y4, y5]
469469

0 commit comments

Comments
 (0)