Skip to content

Commit 408f3de

Browse files
authored
Merge branch 'master' into np2
2 parents 749d5df + bd1dd66 commit 408f3de

File tree

2,457 files changed

+89642
-5190
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,457 files changed

+89642
-5190
lines changed

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +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] - TBD
6-
7-
### Updated
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)]
819
- Specify Python version 3.8-3.11 for development virtual environments and pin `pytest` at version 8.1.1 to match.
920
- 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].
1021

22+
1123
## [5.22.0] - 2024-05-01
1224

1325
### Updated

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
## Quickstart
4242

43-
`pip install plotly==5.22.0`
43+
`pip install plotly==5.23.0`
4444

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

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

8787
```
88-
pip install plotly==5.22.0
88+
pip install plotly==5.23.0
8989
```
9090

9191
or conda.
9292

9393
```
94-
conda install -c plotly plotly=5.22.0
94+
conda install -c plotly plotly=5.23.0
9595
```
9696

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

114114
```
115115
# JupyterLab 2.x renderer support
116-
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
117117
```
118118

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

binder/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jupytext
2-
plotly==5.22.0
2+
plotly==5.23.0
33
jupyter
44
notebook
55
pandas==2.2.2

doc/apidoc/Makefile

Lines changed: 1 addition & 1 deletion
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

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

3131

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

doc/python/axes.md

Lines changed: 58 additions & 2 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.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.
@@ -448,6 +448,62 @@ fig.update_yaxes(minor_ticks="inside")
448448
fig.show()
449449
```
450450

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 further 15 pixels away from the x-axis. A negative value here would move them close 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+
451507
### Axis lines: grid and zerolines
452508

453509
##### Toggling Axis grid lines

doc/python/configuration-options.md

Lines changed: 1 addition & 1 deletion
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

doc/python/figure-labels.md

Lines changed: 41 additions & 2 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.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!

doc/python/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
5858
`plotly` may be installed using `pip`:
5959

6060
```
61-
$ pip install plotly==5.22.0
61+
$ pip install plotly==5.23.0
6262
```
6363

6464
or `conda`:
6565

6666
```
67-
$ conda install -c plotly plotly=5.22.0
67+
$ conda install -c plotly plotly=5.23.0
6868
```
6969
This package contains everything you need to write figures to standalone HTML files.
7070

@@ -152,7 +152,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,
152152

153153
```
154154
# JupyterLab 2.x renderer support
155-
jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager
155+
jupyter labextension install jupyterlab-plotly@5.23.0 @jupyter-widgets/jupyterlab-manager
156156
```
157157

158158
Please check out our [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple python environments inside Jupyter.

doc/python/multiple-axes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ fig.show()
357357

358358
*New in 5.13*
359359

360-
With overlayed axes, each axis by default has its own number of ticks. You can sync the number of ticks on a cartesian axis with another one it overlays by setting `tickmode="sync"`. In this example, we sync the ticks on the `"Total bill amount"` axis with the `"Total number of diners"` axis that it overlays.
360+
With overlayed axes, each axis by default has its own number of ticks. You can sync the number of ticks on a cartesian axis with another one it overlays by setting `tickmode="sync"`. In this example, we sync the ticks on the `"Total bill amount"` axis with the `"Total number of diners"` axis that it overlays.
361361

362362
```python
363363
import plotly.graph_objects as go
@@ -415,4 +415,4 @@ fig.show()
415415
```
416416

417417
#### Reference
418-
All of the y-axis properties are found here: https://plotly.com/python/reference/YAxis/. For more information on creating subplots see the [Subplots in Python](/python/subplots/) section.
418+
All of the y-axis properties are found here: https://plotly.com/python/reference/layout/yaxis/. For more information on creating subplots see the [Subplots in Python](/python/subplots/) section.

0 commit comments

Comments
 (0)