Skip to content

Commit da19326

Browse files
Merge branch 'doc-prod'
2 parents 24e0aac + e97408c commit da19326

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

doc/python/facet-plots.md

+20-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: "1.1"
9-
jupytext_version: 1.1.1
8+
format_version: '1.2'
9+
jupytext_version: 1.3.4
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.6.8
23+
version: 3.7.0
2424
plotly:
2525
description: How to make Facet and Trellis Plots in Python with Plotly.
2626
display_as: statistical
@@ -31,8 +31,8 @@ jupyter:
3131
page_type: u-guide
3232
permalink: python/facet-plots/
3333
redirect_from:
34-
- python/trellis-plots/
35-
- python/facet-trellis/
34+
- python/trellis-plots/
35+
- python/facet-trellis/
3636
thumbnail: thumbnail/facet-trellis-thumbnail.jpg
3737
---
3838

@@ -81,7 +81,7 @@ fig = px.histogram(df, x="total_bill", y="tip", color="sex", facet_row="time", f
8181
fig.show()
8282
```
8383

84-
### Facets with independent axes
84+
### Facets With Independent Axes
8585

8686
By default, facet axes are linked together: zooming inside one of the facets will also zoom in the other facets. You can disable this behaviour when you use `facet_row` only, by disabling `matches` on the Y axes, or when using `facet_col` only, by disabling `matches` on the X axes. It is not recommended to use this approach when using `facet_row` and `facet_col` together, as in this case it becomes very hard to understand the labelling of axes and grid lines.
8787

@@ -101,6 +101,20 @@ fig.update_xaxes(matches=None)
101101
fig.show()
102102
```
103103

104+
### Customize Subplot Figure Titles
105+
106+
Since subplot figure titles are [annotations](https://plot.ly/python/text-and-annotations/#simple-annotation), you can use the `for_each_annotation` function to customize them.
107+
108+
In the following example, we pass a lambda function to `for_each_annotation` in order to change the figure subplot titles from `smoker=No` and `smoker=Yes` to just `No` and `Yes`.
109+
110+
```python
111+
import plotly.express as px
112+
113+
fig = px.scatter(px.data.tips(), x="total_bill", y="tip", facet_col="smoker")
114+
fig.for_each_annotation(lambda a: a.update(text=a.text.split("=")[-1]))
115+
fig.show()
116+
```
117+
104118
```python
105119

106120
```

0 commit comments

Comments
 (0)