How to populate a hoverplate with a value (split in two lines) in Plotly?

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()

Hi @LouizZanjroz,

maybe I am missing something but does this create the desired result?

'custom': {1: 'info 1 <br>info 2', 2: 'info 1 |x| info 2'},

Hi @AIMPED - you are spot on - the solution was simpler than I thought it was. Many thanks.