Position of annotation in line chart

Hello, how do I specify the position of an annotation when visualizing my line chart? by default one value is on top of the line and the second is below the line. What if I have 3 lines on one subplot? How do I make all annotations go either on top of the lines they represent or below.

1 Like

Hi @rayolufadeju,


By Annotation, are you referring to the Men and Women text in this plot?


You can use the Axes.text() method. The first two arguments will be the x and y coordinates (matching your axes ranges) where you want to place the annotation, and the last argument will be your text.

axes.text(x-coord,y-coord,‘text’). You can place how many annotations you want.

You can read more about this in the documentation, and in the Color, Layout, and Annotations mission, slide 7.
Hope this helps =)

1 Like

yes, that’s what I’m referring to.

1 Like

thanks for responding.
the documentation says x,y.
what if I have an additional “Z” variable? Can I just add the positions I want and continue?

also, I have to print out the plot to see where the annotations should be.
is there a code to tell the annotation where to stay?
e.g smallest gap between both lines?

Yes, for 3D plotting the procedure is the same, as you can see in here.

As far as I know (and how I’ve done so far) it is supposed to be by trial and error, printing the plot and adjusting accordingly to what we want.


Thank you so much. This cleared my confusion. I experimented with it like you recommended.

1 Like