Skip to content

Commit 6ed004b

Browse files
authored
Merge branch 'master' into recent-docs-updates
2 parents 2fa17d9 + 56ec663 commit 6ed004b

File tree

2,143 files changed

+76804
-908
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,143 files changed

+76804
-908
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
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
6+
7+
### Updated
8+
- 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:
9+
- Add "bold" weight, "italic" style and "small-caps" variant options to fonts [#6956]
10+
- 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!
11+
- Fix positioning of multi-line axis titles with standoff [#6970], with thanks to @my-tien for the contribution!
12+
513
## [5.21.0] - 2024-04-17
614

715
### Updated

doc/python/figure-labels.md

+56-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.14.5
9+
jupytext_version: 1.16.1
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.9
23+
version: 3.10.11
2424
plotly:
2525
description: How to set the global font, title, legend-entries, and axis-titles
2626
in python.
@@ -159,6 +159,60 @@ fig.update_layout(
159159
fig.show()
160160
```
161161

162+
### Configuring Font Variant, Style, and Weight
163+
164+
*New in 5.22*
165+
166+
You can configure a `variant`, `style`, and `weight` on `layout.font`. Here, we set the font variant to `small-caps`.
167+
168+
```python
169+
import plotly.graph_objects as go
170+
from plotly import data
171+
172+
df = data.iris()
173+
174+
setosa_df = df[df["species"] == "setosa"]
175+
versicolor_df = df[df["species"] == "versicolor"]
176+
virginica_df = df[df["species"] == "virginica"]
177+
178+
fig = go.Figure(
179+
data=[
180+
go.Scatter(
181+
x=setosa_df["sepal_width"],
182+
y=setosa_df["sepal_length"],
183+
mode="markers",
184+
name="setosa",
185+
),
186+
go.Scatter(
187+
x=versicolor_df["sepal_width"],
188+
y=versicolor_df["sepal_length"],
189+
mode="markers",
190+
name="versicolor",
191+
),
192+
go.Scatter(
193+
x=virginica_df["sepal_width"],
194+
y=virginica_df["sepal_length"],
195+
mode="markers",
196+
name="virginica",
197+
),
198+
],
199+
layout=go.Layout(
200+
title="Plot Title",
201+
xaxis=dict(title="X Axis Title"),
202+
yaxis=dict(title="Y Axis Title"),
203+
legend=dict(title="Legend Title"),
204+
font=dict(
205+
family="Courier New, monospace",
206+
size=18,
207+
color="RebeccaPurple",
208+
variant="small-caps",
209+
)
210+
)
211+
)
212+
213+
fig.show()
214+
```
215+
162216
The configuration of the legend is discussed in detail in the [Legends](/python/legend/) page.
163217

164218
### Align Plot Title

doc/python/text-and-annotations.md

+49-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ fig.update_layout(
307307
fig.show()
308308
```
309309

310-
### Custom Text Color and Styling
310+
### Font Color, Size, and Familiy
311+
312+
Use `textfont` to specify a font `family`, `size`, or `color`.
311313

312314
```python
313315
import plotly.graph_objects as go
@@ -347,6 +349,52 @@ fig.update_layout(showlegend=False)
347349
fig.show()
348350
```
349351

352+
### Font Style, Variant, and Weight
353+
354+
*New in 5.22*
355+
356+
You can also configure a font's `variant`, `style`, and `weight` on `textfont`. Here, we configure an `italic` style on the first bar, `bold` weight on the second, and`small-caps` as the font variant on the third.
357+
358+
```python
359+
import plotly.graph_objects as go
360+
from plotly import data
361+
362+
df = data.medals_wide()
363+
364+
fig = go.Figure(
365+
data=[
366+
go.Bar(
367+
x=df.nation,
368+
y=df.gold,
369+
name="Gold",
370+
marker=dict(color="Gold"),
371+
text="Gold",
372+
textfont=dict(style="italic"),
373+
),
374+
go.Bar(
375+
x=df.nation,
376+
y=df.silver,
377+
name="Silver",
378+
marker=dict(color="MediumTurquoise"),
379+
text="Silver",
380+
textfont=dict(weight="bold"),
381+
),
382+
go.Bar(
383+
x=df.nation,
384+
y=df.bronze,
385+
name="Bronze",
386+
marker=dict(color="LightGreen"),
387+
text="Bronze",
388+
textfont=dict(variant="small-caps"),
389+
),
390+
],
391+
layout=dict(barcornerradius=15, showlegend=False),
392+
)
393+
394+
fig.show()
395+
396+
```
397+
350398
### Styling and Coloring Annotations
351399

352400
```python

packages/javascript/jupyterlab-plotly/package-lock.json

+17-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/javascript/jupyterlab-plotly/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@lumino/messaging": "^1.2.3",
6666
"@lumino/widgets": "^1.8.1",
6767
"lodash": "^4.17.4",
68-
"plotly.js": "^2.31.1"
68+
"plotly.js": "^2.32.0"
6969
},
7070
"jupyterlab": {
7171
"extension": "lib/jupyterlab-plugin",

0 commit comments

Comments
 (0)