Adding labels to a chord diagram


I’m fairly new to Plotly and still trying to get the hang of it. I’m now trying to create a chord diagram with my own data, based on

While I can get a chord diagram using my own data, I would also like to add labels next to the ‘slices’ in a similar fashion as shown in (at the bottom). In the R example of the Plotly library I see there is a function called ‘add_text’, which I cannot find in the Python version of the library.

I tried using annotations in the make_layout function, but while this does add text, it is not possible to position the text and it also crops the image.

Does anybody have any clue as how to achieve this seemingly simple task of adding slice labels?

Hi @Timmolleman,

See for an example of positioning annotation text in data coordinates (which is what I think you’ll want since the chord diagram args are defined as scatter traces). Note the xref and yref properties.

Another option is to use a scatter trace to display text like You can set the scatter.mode property to 'text'to avoid displaying points or lines as well.

Hope that helps!

Has there been any progress with this? I wondered whether there was now a simpler way to add labels to the outer edges of a chord digram in plotly? I am confused how to write a function such that the labels will be automatically added to each segment.

Thank you in advance for any help!