Skip to content

Commit 61000ba

Browse files
committed
Update chaining example to specify title with px and font size with update_layout
1 parent 1a9fe7b commit 61000ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

notebooks/creating-updating-figures.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,14 @@ There are also `for_each_xaxis` and `for_each_yaxis` methods that are analogous
469469
### Chaining figure operations
470470
With the exception of property assignment, all of the figure update operations described in this section are methods that return a reference to the figure being modified. This makes it possible the chain multiple figure modification operations together into a single expression.
471471

472-
Here is an example of a chained expression that creates a faceted scatter plot with OLS trend lines using plotly express, adds a title using `update_layout`, disables vertical grid lines using `update_xaxes`, updates the width and dash pattern of the trend lines using `update_traces`, and then displays the figure using `show`.
472+
Here is an example of a chained expression that creates a faceted scatter plot with OLS trend lines using plotly express, sets the title font size using `update_layout`, disables vertical grid lines using `update_xaxes`, updates the width and dash pattern of the trend lines using `update_traces`, and then displays the figure using `show`.
473473

474474
```python
475475
import plotly.express as px
476476
iris = px.data.iris()
477-
(px.scatter(iris, x="sepal_width", y="sepal_length", color="species", facet_col="species", trendline='ols')
478-
.update_layout(title_text='Iris Dataset')
477+
(px.scatter(iris, x="sepal_width", y="sepal_length", color="species",
478+
facet_col="species", trendline="ols", title="Iris Dataset")
479+
.update_layout(title_font_size=24)
479480
.update_xaxes(showgrid=False)
480481
.update_traces(
481482
line={'dash': 'dot', 'width': 4},

0 commit comments

Comments
 (0)