6
6
extension : .md
7
7
format_name : markdown
8
8
format_version : ' 1.3'
9
- jupytext_version : 1.14.5
9
+ jupytext_version : 1.16.1
10
10
kernelspec :
11
11
display_name : Python 3 (ipykernel)
12
12
language : python
@@ -20,7 +20,7 @@ jupyter:
20
20
name : python
21
21
nbconvert_exporter : python
22
22
pygments_lexer : ipython3
23
- version : 3.10.9
23
+ version : 3.10.11
24
24
plotly :
25
25
description : How to set the global font, title, legend-entries, and axis-titles
26
26
in python.
@@ -159,6 +159,60 @@ fig.update_layout(
159
159
fig.show()
160
160
```
161
161
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
+
162
216
The configuration of the legend is discussed in detail in the [ Legends] ( /python/legend/ ) page.
163
217
164
218
### Align Plot Title
0 commit comments