Skip to content

Commit 234fb0a

Browse files
author
“mahdis-z”
committed
minor revisions
1 parent bfaf23d commit 234fb0a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

python/hovertemplate.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ jupyter:
3737
v4upgrade: true
3838
---
3939

40-
### Add Hover Template to Pie Chart
40+
### Customize tooltip text with a hovertemplate
4141

4242
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.
43+
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).
44+
Hovertemplate customize the tooltip text vs. [texttemplate](https://plot.ly/python/reference/#pie-texttemplate) which customizes the text that appears on your chart.
4345

4446
```python
4547
import plotly.graph_objects as go
@@ -59,9 +61,9 @@ fig.show()
5961

6062
```python
6163
import plotly.io as pio
62-
import pandas as pd
64+
import plotly.express as px
6365

64-
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv")
66+
df = px.data.gapminder()
6567
A = []
6668
B = []
6769

@@ -129,3 +131,7 @@ fig.update_layout(
129131

130132
fig.show()
131133
```
134+
135+
```python
136+
137+
```

0 commit comments

Comments
 (0)