Skip to content

Merge master back to doc-prod to make docs changes live (5.22) #4595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 1, 2024
Merged
  •  
  •  
  •  
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/).

## [5.22.0] - 2024-05-01

### 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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## Quickstart

`pip install plotly==5.21.0`
`pip install plotly==5.22.0`

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

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

```
pip install plotly==5.21.0
pip install plotly==5.22.0
```

or conda.

```
conda install -c plotly plotly=5.21.0
conda install -c plotly plotly=5.22.0
```

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.21.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager
```

Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
Expand Down
2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jupytext
plotly==5.21.0
plotly==5.22.0
jupyter
notebook
pandas==1.2.0
Expand Down
2 changes: 1 addition & 1 deletion doc/apidoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "5.21.0"
release = "5.22.0"


# -- General configuration ---------------------------------------------------
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
6 changes: 3 additions & 3 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
`plotly` may be installed using `pip`:

```
$ pip install plotly==5.21.0
$ pip install plotly==5.22.0
```

or `conda`:

```
$ conda install -c plotly plotly=5.21.0
$ conda install -c plotly plotly=5.22.0
```
This package contains everything you need to write figures to standalone HTML files.

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.21.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.22.0 @jupyter-widgets/jupyterlab-manager
```

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.
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
3 changes: 2 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plotly==5.21.0
plotly==5.22.0
jupytext==1.1.1
ipywidgets==7.7.2
jupyter-client<7
Expand Down Expand Up @@ -45,3 +45,4 @@ jinja2<3.1
parmed<=3.4.4; python_version<"3.8"
dask==2022.2.0
polars
geoparse<=2.0.3
37 changes: 19 additions & 18 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.

4 changes: 2 additions & 2 deletions packages/javascript/jupyterlab-plotly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-plotly",
"version": "5.21.0",
"version": "5.22.0",
"description": "The plotly Jupyter extension",
"author": "The plotly.py team",
"license": "MIT",
Expand Down 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
Loading