Skip to content

Commit d25e721

Browse files
authored
Merge pull request #175 from plotly/hoverlabel_py_
hoverlabel alignment
2 parents 772d907 + 9dbcc3d commit d25e721

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/hover-text-and-formatting.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ fig.show()
104104

105105
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.
106106
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).
107-
Hovertemplate customize the tooltip text vs. [texttemplate](https://plot.ly/python/reference/#pie-texttemplate) which customizes the text that appears on your chart.
107+
Hovertemplate customize the tooltip text vs. [texttemplate](https://plot.ly/python/reference/#pie-texttemplate) which customizes the text that appears on your chart. <br>
108+
Set the horizontal alignment of the text within tooltip with [hoverlabel.align](https://plot.ly/python/reference/#layout-hoverlabel-align).
108109

109110
```python
110111
import plotly.graph_objects as go
@@ -125,7 +126,9 @@ fig.add_trace(go.Scatter(
125126
hovertemplate = 'Price: %{y:$.2f}<extra></extra>',
126127
showlegend = False))
127128

128-
fig.update_layout(title = "Set hover text with hovertemplate")
129+
fig.update_layout(
130+
hoverlabel_align = 'right',
131+
title = "Set hover text with hovertemplate")
129132

130133
fig.show()
131134
```

0 commit comments

Comments
 (0)