How to add (clickable) hyperlinks to a Sunburst in Plotly without using Dash?

Hi @LouizZanjroz. You can use html.

import pandas as pd
import plotly.express as px

data = {'site': {1: 'Site 1', 2: 'Site 2', },
        'link': {1: '<a href="http://www.google.com">link text</a>', 2: 'http://www.facebook.com'},
        'popularity': {1: 50, 2: 50}}

df = pd.DataFrame(data)

fig = px.sunburst(df,
                  path=['site', 'link'],
                  values='popularity',
                  maxdepth=2,)

fig.show()
1 Like