Skip to content

Commit b330b0e

Browse files
committed
add font weights example
1 parent aab5efe commit b330b0e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/python/text-and-annotations.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,6 @@ In the previous example, we set a `font-weight` using a keyword value. You can a
404404
The font weights available depend on the `font-family` that is set. The `font-weight`
405405
If you set a `font-weight` that isn't available for a particular `font-family`, the weight will be rounded to the nearest available value.
406406

407-
In the following example,
408-
409407

410408
```python
411409
import plotly.graph_objects as go
@@ -421,23 +419,23 @@ fig = go.Figure(
421419
name="Gold",
422420
marker=dict(color="Gold"),
423421
text="Gold",
424-
textfont=dict(weight=400, size=17),
422+
textfont=dict(weight=900, size=17),
425423
),
426424
go.Bar(
427425
x=df.nation,
428426
y=df.silver,
429427
name="Silver",
430428
marker=dict(color="MediumTurquoise"),
431429
text="Silver",
432-
textfont=dict(weight=600, size=17),
430+
textfont=dict(size=17),
433431
),
434432
go.Bar(
435433
x=df.nation,
436434
y=df.bronze,
437435
name="Bronze",
438436
marker=dict(color="LightGreen"),
439437
text="Bronze",
440-
textfont=dict(weight=1000, size=17),
438+
textfont=dict(size=17),
441439
),
442440
],
443441
layout=dict(barcornerradius=15, showlegend=False),
@@ -446,6 +444,9 @@ fig = go.Figure(
446444
fig.show()
447445
```
448446

447+
[scattergl](https://plotly.com/python/reference/scattergl) traces do not support all numeric font weights. Font weights up to 500 are mapped to the keyword font weight "normal", while weights above 500 are mapped to "bold".
448+
449+
449450
### Styling and Coloring Annotations
450451

451452
```python

0 commit comments

Comments
 (0)