Skip to content

Commit

Permalink
Merge branch 'master' into recent-docs-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamConnors committed Apr 25, 2024
2 parents 2fa17d9 + 56ec663 commit 6ed004b
Show file tree
Hide file tree
Showing 2,143 changed files with 76,804 additions and 908 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## UNRELEASED

### Updated
- 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:
- Add "bold" weight, "italic" style and "small-caps" variant options to fonts [#6956]
- 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!
- Fix positioning of multi-line axis titles with standoff [#6970], with thanks to @my-tien for the contribution!

## [5.21.0] - 2024-04-17

### Updated
Expand Down
58 changes: 56 additions & 2 deletions doc/python/figure-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.5
jupytext_version: 1.16.1
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.10.9
version: 3.10.11
plotly:
description: How to set the global font, title, legend-entries, and axis-titles
in python.
Expand Down Expand Up @@ -159,6 +159,60 @@ fig.update_layout(
fig.show()
```

### Configuring Font Variant, Style, and Weight

*New in 5.22*

You can configure a `variant`, `style`, and `weight` on `layout.font`. Here, we set the font variant to `small-caps`.

```python
import plotly.graph_objects as go
from plotly import data

df = data.iris()

setosa_df = df[df["species"] == "setosa"]
versicolor_df = df[df["species"] == "versicolor"]
virginica_df = df[df["species"] == "virginica"]

fig = go.Figure(
data=[
go.Scatter(
x=setosa_df["sepal_width"],
y=setosa_df["sepal_length"],
mode="markers",
name="setosa",
),
go.Scatter(
x=versicolor_df["sepal_width"],
y=versicolor_df["sepal_length"],
mode="markers",
name="versicolor",
),
go.Scatter(
x=virginica_df["sepal_width"],
y=virginica_df["sepal_length"],
mode="markers",
name="virginica",
),
],
layout=go.Layout(
title="Plot Title",
xaxis=dict(title="X Axis Title"),
yaxis=dict(title="Y Axis Title"),
legend=dict(title="Legend Title"),
font=dict(
family="Courier New, monospace",
size=18,
color="RebeccaPurple",
variant="small-caps",
)
)
)

fig.show()
```

The configuration of the legend is discussed in detail in the [Legends](/python/legend/) page.

### Align Plot Title
Expand Down
50 changes: 49 additions & 1 deletion doc/python/text-and-annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ fig.update_layout(
fig.show()
```

### Custom Text Color and Styling
### Font Color, Size, and Familiy

Use `textfont` to specify a font `family`, `size`, or `color`.

```python
import plotly.graph_objects as go
Expand Down Expand Up @@ -347,6 +349,52 @@ fig.update_layout(showlegend=False)
fig.show()
```

### Font Style, Variant, and Weight

*New in 5.22*

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.

```python
import plotly.graph_objects as go
from plotly import data

df = data.medals_wide()

fig = go.Figure(
data=[
go.Bar(
x=df.nation,
y=df.gold,
name="Gold",
marker=dict(color="Gold"),
text="Gold",
textfont=dict(style="italic"),
),
go.Bar(
x=df.nation,
y=df.silver,
name="Silver",
marker=dict(color="MediumTurquoise"),
text="Silver",
textfont=dict(weight="bold"),
),
go.Bar(
x=df.nation,
y=df.bronze,
name="Bronze",
marker=dict(color="LightGreen"),
text="Bronze",
textfont=dict(variant="small-caps"),
),
],
layout=dict(barcornerradius=15, showlegend=False),
)

fig.show()

```

### Styling and Coloring Annotations

```python
Expand Down
33 changes: 17 additions & 16 deletions packages/javascript/jupyterlab-plotly/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/javascript/jupyterlab-plotly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@lumino/messaging": "^1.2.3",
"@lumino/widgets": "^1.8.1",
"lodash": "^4.17.4",
"plotly.js": "^2.31.1"
"plotly.js": "^2.32.0"
},
"jupyterlab": {
"extension": "lib/jupyterlab-plugin",
Expand Down

0 comments on commit 6ed004b

Please sign in to comment.