Black Lives Matter. Please consider donating to Black Girls Code today.

Line's name in a line plot

I need the name each of several lines to be printed right on it (as it is in plotly countures). Is there some function to do this?

Hi @vanis there are several ways to do this, one of them would be to add an annotation for each line and place it at the position of one of the points of the line. Or you could add a text array to a scatter trace, which would consist of empty strings everywhere but one point where you want the text to appear, see for example https://plot.ly/python/text-and-annotations/#adding-text-to-data-in-line-and-scatter-plots. Please read through the different examples in https://plot.ly/python/text-and-annotations/ to see how to do this (either with annotations or with text).

1 Like