Sunburst: introducing attributes with customdata

Hi guys,

In spite of the new release (v4.6.0), I believe the variable “customdata” is not correctly handled in the sunburst. For instance, the case to follow doesn’t work properly:

customdata=np.dstack((a, b)),
hovertemplate='<br>%{customdata[0]:.3f} <br> %{customdata[1]:.3f} ',

However, if I have simply

customdata=a,
hovertemplate='<br>%{customdata:.3f} <br>',

then everything works smoothly.

@xanderwallace

Here is a tutorial on how to define customdata for any trace type: https://plotly.com/~empet/15366/customdata-for-a-few-plotly-chart-types/#/

Hi @empet,

Thank you so much! The problem was the way arrays were stacked:
I used customdata=np.dstack((a, b)) instead of customdata=np.stack((a, b), axis=-1).
I saw the “wrong” version somewhere in the plotly documentation though :confused:
Thank you again! :slight_smile:

I think @empet link shoud be in the oficial documentation.