Add hover text from different source/data size

Hi,

I have two data sets, the first is topics # and their size, the second is few words from each topic.

first:

	topic	len
0	topic 19	3394
1	topic 18	3391
2	topic 17	6824
3	topic 16	4394

second:

	index	0	1	2	3	4	5	6	7	8	...	42	43	44	45	46	47	48	49	50	51
0	topic 19	island	de	la	surface	age	anaga	valleys	material	rocks	...	descendants	volcano	diversity	quantities	climates	continuity	fall	sediments	slopes	construction
1	topic 18	tenerife	island	de	cruz	development	°	santa	tourism	la	...	conquest	expeditions	farms	eternal	janeiro	calatrava	habitats	marítimo	rio	consumption

I plot the first and wanted to add the second as hover text for each topic in the pie chart.

import plotly.graph_objects as go

labels = dodo['topic']
values = dodo['len']

fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig.show()

Any ideas what should i do to make it work ?
Thanks.

Hi @gefen84,

In order to add more text to be displayed at hover, define from the second data set the list for hovertext:

import plotly.graph_objects as go

labels = ['topic 1','topic 2','topic 3', 'topic 4']
values = [4500, 2500, 1053, 500]

fig = go.Figure(data=[go.Pie(labels=labels, 
                             values=values,
                             hovertext = ['island', 'tenerife', 'rock', 'sand'],
                             hoverinfo = 'label+value+text')])
fig.update_layout(width=700)

To be displayed the strings that define the hovertext list, you must set the hoverinfo property.

From docs we find out how the hoverinfo string can be defined:

“The ‘hoverinfo’ may be specified
as a string containing:
- Any combination of [‘label’, ‘text’, ‘value’, ‘percent’, ‘name’] joined with ‘+’ characters
(e.g. ‘label+text’)
OR exactly one of [‘all’, ‘none’, ‘skip’] (e.g. ‘skip’)
- A list or array of the above”