Skip to content

Commit 9dbcc3d

Browse files
author
“mahdis-z”
committed
hoverlabel alignment
1 parent 64e3bc0 commit 9dbcc3d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/hover-text-and-formatting.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ fig.show()
107107

108108
To customize the tooltip on your graph you can use [hovertemplate](https://plot.ly/python/reference/#pie-hovertemplate), which is a template string used for rendering the information that appear on hoverbox.
109109
This template string can include `variables` in %{variable} format, `numbers` in [d3-format's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_forma), and `date` in [d3-time-fomrat's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format).
110-
Hovertemplate customize the tooltip text vs. [texttemplate](https://plot.ly/python/reference/#pie-texttemplate) which customizes the text that appears on your chart.
110+
Hovertemplate customize the tooltip text vs. [texttemplate](https://plot.ly/python/reference/#pie-texttemplate) which customizes the text that appears on your chart. <br>
111+
Set the horizontal alignment of the text within tooltip with [hoverlabel.align](https://plot.ly/python/reference/#layout-hoverlabel-align).
111112

112113
```python
113114
import plotly.graph_objects as go
@@ -128,7 +129,9 @@ fig.add_trace(go.Scatter(
128129
hovertemplate = 'Price: %{y:$.2f}<extra></extra>',
129130
showlegend = False))
130131

131-
fig.update_layout(title = "Set hover text with hovertemplate")
132+
fig.update_layout(
133+
hoverlabel_align = 'right',
134+
title = "Set hover text with hovertemplate")
132135

133136
fig.show()
134137
```

0 commit comments

Comments
 (0)