This is quite a special use case, but since I donβt mange to find a solution I decide to ask.
I am using the hoverplate
to display information contained in custom_data=['custom']
that is:
info 1 |x| info 2
But I would need to display the info in two lines inside of the hoverplate
such as:
info1
info2
This is the script illustrating the exercise;
import pandas as pd
import plotly.express as px
data = {'site': {1: 'Site 1', 2: 'Site 2', },
'link': {1: 'http://www.google.com', 2: 'http://www.facebook.com'},
'custom': {1: 'info 1 |x| info 2', 2: 'info 1 |x| info 2'},
'popularity': {1: 50, 2: 50}}
df = pd.DataFrame(data)
fig = px.sunburst(df,
path=['site', 'link'],
values='popularity',
custom_data=['custom'],
maxdepth=2,)
fig.update_traces(hovertemplate="<b>%{customdata[0]}</b><br><br>")
fig.show()