You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can configure text case using the `textfont.textcase` property. In this example, we set `textfont.textcase="upper"` to transform the text on all bars to uppercase.
# Set to lower" for lowercase text, or "word caps" to capitalize the first letter of each word
474
474
textcase="upper"
475
-
475
+
476
476
)
477
477
),
478
478
layout=go.Layout(
@@ -486,9 +486,9 @@ fig.show()
486
486
487
487
## Text Lines
488
488
489
-
**New in 5.23**
489
+
*New in 5.23*
490
490
491
-
You can add decoration lines to text using the `textfont.lineposition` property. This property accepts `"under"`, `"over"`, and `"through"`, or a combination of these separated by a `+`.
491
+
You can add decoration lines to text using the `textfont.lineposition` property. This property accepts `"under"`, `"over"`, and `"through"`, or a combination of these separated by a `+`.
lineposition="under"# combine different line positions with a "+" to add more than one: "under+over"
510
510
)
511
511
),
@@ -520,7 +520,7 @@ fig.show()
520
520
521
521
## Text Shadow
522
522
523
-
**New in 5.23**
523
+
*New in 5.23*
524
524
525
525
You can apply a shadow effect to text using the `textfont.shadow` property. This property accepts shadow specifications in the same format as the [text-shadow CSS property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow).
The `text` attribute supports the following HTML tags: `<br>`,`<b>`,`<a>`, `<em>`, `<sup>` and `<span>`.
659
+
In version 5.23 and later, `<s>` and `<u>`are also supported.
660
+
661
+
```python
662
+
import plotly.graph_objects as go
663
+
664
+
fig = go.Figure(
665
+
data=[
666
+
go.Scatter(
667
+
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
668
+
y=[0, 1, 3, 2, 4, 3, 4, 6, 5],
669
+
mode="lines+markers",
670
+
name="Series 1",
671
+
),
672
+
go.Scatter(
673
+
x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
674
+
y=[0, 4, 5, 1, 2, 2, 3, 4, 2],
675
+
mode="lines+markers",
676
+
name="Series 2",
677
+
),
678
+
],
679
+
layout=go.Layout(
680
+
annotations=[
681
+
dict(
682
+
x=2,
683
+
y=5,
684
+
text="Text annotation using <b>bolded text</b>, <i>italicized text</i>, <u>underlined text</u>, <br>and a new line",
685
+
showarrow=True,
686
+
arrowhead=1,
687
+
),
688
+
dict(
689
+
x=4,
690
+
y=4,
691
+
text="Text annotation with <a href='https://dash.plotly.com'>a link</a>.",
692
+
showarrow=False,
693
+
yshift=10,
694
+
),
695
+
],
696
+
showlegend=False,
697
+
),
698
+
)
699
+
700
+
fig.show()
701
+
702
+
```
703
+
656
704
### Positioning Text Annotations Absolutely
657
705
658
706
By default, text annotations have `xref` and `yref` set to `"x"` and `"y"`, respectively, meaning that their x/y coordinates are with respect to the axes of the plot. This means that panning the plot will cause the annotations to move. Setting `xref` and/or `yref` to `"paper"` will cause the `x` and `y` attributes to be interpreted in [paper coordinates](/python/figure-structure/#positioning-with-paper-container-coordinates-or-axis-domain-coordinates).
0 commit comments