Skip to content

Commit 4d3b236

Browse files
authored
Merge branch 'doc-prod' into jupyterlab-clarification
2 parents f1e22f2 + 507d7f2 commit 4d3b236

File tree

2,469 files changed

+89753
-5254
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,469 files changed

+89753
-5254
lines changed

Diff for: .circleci/config.yml

+2-1
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
@@ -599,3 +599,4 @@ workflows:
599599
- python_38_orca
600600
- python_39_percy
601601
- build-doc
602+

Diff for: CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
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] - 2024-07-23
6+
7+
### Updated
8+
- Updated Plotly.js from version 2.32.0 to version 2.34.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2340----2024-07-18) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
9+
- Add `subtitle` attribute to `layout.title` to enable adding subtitles to plots [[#7012](https://github.com/plotly/plotly.js/pull/7012)]
10+
- Introduce "u" and "s" pseudo html tags to add partial underline and strike-through styles to SVG text elements [[#7043](https://github.com/plotly/plotly.js/pull/7043)]
11+
- Add geometric mean functionality and 'geometric mean ascending' + 'geometric mean descending' to `category_order` on cartesian axes [[#6223](https://github.com/plotly/plotly.js/pull/6223)],
12+
with thanks to @acxz and @prabhathc for the contribution!
13+
- Add axis property `ticklabelindex` for drawing the label for each minor tick n positions away from a major tick,
14+
with thanks to @my-tien for the contribution! [[#7036](https://github.com/plotly/plotly.js/pull/7036)]
15+
- Add property `ticklabelstandoff` and `ticklabelshift` to cartesian axes to adjust positioning of tick labels,
16+
with thanks to @my-tien for the contribution! [[#7006](https://github.com/plotly/plotly.js/pull/7006)]
17+
- Add `x0shift`, `x1shift`, `y0shift`, `y1shift` to shapes to add control over positioning of shape vertices on (multi-)category axes,
18+
with thanks to @my-tien for the contribution! [[#7005](https://github.com/plotly/plotly.js/pull/7005)]
19+
- Specify Python version 3.8-3.11 for development virtual environments and pin `pytest` at version 8.1.1 to match.
20+
- 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].
21+
22+
523
## [5.22.0] - 2024-05-01
624

725
### Updated

Diff for: README.md

+11-4
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.22.0`
43+
`pip install plotly==5.23.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.22.0
88+
pip install plotly==5.23.0
8289
```
8390

8491
or conda.
8592

8693
```
87-
conda install -c plotly plotly=5.22.0
94+
conda install -c plotly plotly=5.23.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.22.0 @jupyter-widgets/jupyterlab-manager
116+
jupyter labextension install jupyterlab-plotly@5.23.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.

Diff for: binder/requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
jupytext
2-
plotly==5.22.0
2+
plotly==5.23.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

Diff for: contributing.md

+5-2
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

Diff for: doc/apidoc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ help:
3636
# Remove files which were added only for docstring generation
3737
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
3838
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
39-
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
39+
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html _build/html/generated/generated/*.html
4040
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
4141
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
4242
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv

Diff for: doc/apidoc/conf.py

+1-1
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.22.0"
29+
release = "5.23.0"
3030

3131

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

Diff for: doc/python/3d-volume.md

+1-1
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)

Diff for: doc/python/axes.md

+72-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.16.1
9+
jupytext_version: 1.16.3
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.10.11
23+
version: 3.10.14
2424
plotly:
2525
description: How to adjust axes properties in Python - axes titles, styling and
2626
coloring axes and grid lines, ticks, tick labels and more.
@@ -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()
@@ -444,6 +448,62 @@ fig.update_yaxes(minor_ticks="inside")
444448
fig.show()
445449
```
446450

451+
#### Adjust Tick Label Positions
452+
453+
*New in 5.23*
454+
455+
You can adjust tick label positions by moving them a number of pixels away from the axis using `ticklabelstandoff` or along the axis using `ticklabelshift`.
456+
457+
In this example, `ticklabelshift=25` shifts the labels 25 pixels to the right along the x-axis. By providing a negative value, we could move the labels 25 pixels to the left, (`ticklabelshift=-25`).
458+
459+
Here, `ticklabelstandoff=15` moves the labels 15 pixels further away from the x-axis. A negative value here would move them closer to the axis.
460+
461+
```python
462+
import plotly.express as px
463+
464+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
465+
466+
fig = px.line(df, x='Date', y='AAPL.High')
467+
468+
fig.update_layout(
469+
xaxis=dict(
470+
ticks='outside',
471+
ticklen=10,
472+
ticklabelshift=25,
473+
ticklabelstandoff=15
474+
)
475+
)
476+
477+
fig.show()
478+
```
479+
480+
#### Use Minor Tick for Label
481+
482+
*New in 5.23*
483+
484+
On date or linear axes, use `ticklabelindex` to draw a label for a minor tick instead of a major tick.
485+
486+
To draw the label for the minor tick before each major tick, set `ticklabelindex=-1`, like in the following example.
487+
488+
```python
489+
import plotly.express as px
490+
491+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
492+
493+
fig = px.line(df, x='Date', y='AAPL.High')
494+
495+
fig.update_layout(
496+
xaxis=dict(
497+
minor=dict(ticks='outside'),
498+
ticks='outside',
499+
ticklen=10,
500+
ticklabelindex=-1
501+
)
502+
)
503+
504+
fig.show()
505+
```
506+
447507
### Axis lines: grid and zerolines
448508

449509
##### Toggling Axis grid lines
@@ -599,7 +659,7 @@ fig.show()
599659

600660
*New in 5.17*
601661

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.
662+
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.
603663

604664
```python
605665
import plotly.express as px
@@ -857,7 +917,7 @@ fig.show()
857917

858918
#### <code>nonnegative</code>, <code>tozero</code>, and <code>normal</code> Rangemode
859919

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

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

@@ -898,7 +958,7 @@ fig.update_xaxes(autorangeoptions=dict(maxallowed=5))
898958
fig.show()
899959
```
900960

901-
##### Clip Minimum and Maximum
961+
##### Clip Minimum and Maximum
902962

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

@@ -916,7 +976,7 @@ fig.show()
916976

917977
##### Specify Values to be Included
918978

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.
979+
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.
920980

921981
```python
922982
import plotly.express as px

Diff for: doc/python/box-plots.md

+6-6
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

Diff for: doc/python/configuration-options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fig.show()
252252

253253
*New in v4.7*
254254

255-
Some modebar buttons of Cartesian plots are optional and have to be added explicitly, using the `modeBarButtonsToAdd` config attribute. These buttons are used for drawing or erasing shapes. See [the tutorial on shapes and shape drawing](python/shapes#drawing-shapes-on-cartesian-plots) for more details.
255+
Some modebar buttons of Cartesian plots are optional and have to be added explicitly, using the `modeBarButtonsToAdd` config attribute. These buttons are used for drawing or erasing shapes. See [the tutorial on shapes and shape drawing](/python/shapes#drawing-shapes-with-a-mouse-on-cartesian-plots) for more details.
256256

257257
```python
258258
import plotly.express as px

Diff for: doc/python/figure-labels.md

+41-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.3'
9-
jupytext_version: 1.16.1
9+
jupytext_version: 1.16.3
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.10.11
23+
version: 3.10.14
2424
plotly:
2525
description: How to set the global font, title, legend-entries, and axis-titles
2626
in python.
@@ -236,5 +236,44 @@ fig.update_layout(
236236
fig.show()
237237
```
238238

239+
### Adding a Plot Subtitle
240+
241+
*New in 5.23*
242+
243+
Add a subtitle to a plot with `layout.title.subtitle`. In the following example, we set the subtitle's `text`, and configure the `font` `color` and `size`. By default, if you don't set a font size for the subtitle, it will be `0.7` of the `title` font size.
244+
245+
```python
246+
import plotly.graph_objects as go
247+
from plotly import data
248+
249+
df = data.gapminder().query("continent == 'Europe' and (year == 1952 or year == 2002)")
250+
251+
df_pivot = df.pivot(index="country", columns="year", values="lifeExp")
252+
253+
fig = go.Figure(
254+
[
255+
go.Bar(
256+
x=df_pivot.index, y=df_pivot[1952], name="1952", marker_color="IndianRed"
257+
),
258+
go.Bar(
259+
x=df_pivot.index, y=df_pivot[2002], name="2002", marker_color="LightSalmon"
260+
),
261+
],
262+
layout=dict(
263+
title=dict(
264+
text="Life Expectancy",
265+
subtitle=dict(
266+
text="Life expectancy by European country in 1952 and in 2002",
267+
font=dict(color="gray", size=13),
268+
),
269+
)
270+
),
271+
)
272+
273+
274+
fig.show()
275+
276+
```
277+
239278
#### Reference
240279
See https://plotly.com/python/reference/layout/ for more information!

0 commit comments

Comments
 (0)