66 extension : .md
77 format_name : markdown
88 format_version : ' 1.3'
9- jupytext_version : 1.14.5
9+ jupytext_version : 1.16.1
1010 kernelspec :
1111 display_name : Python 3 (ipykernel)
1212 language : python
@@ -20,7 +20,7 @@ jupyter:
2020 name : python
2121 nbconvert_exporter : python
2222 pygments_lexer : ipython3
23- version : 3.10.9
23+ version : 3.10.11
2424 plotly :
2525 description : How to set the global font, title, legend-entries, and axis-titles
2626 in python.
@@ -159,6 +159,60 @@ fig.update_layout(
159159fig.show()
160160```
161161
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+
162216The configuration of the legend is discussed in detail in the [ Legends] ( /python/legend/ ) page.
163217
164218### Align Plot Title
0 commit comments