Plots.jl : positioning and scaling of "annotate!"

I would like to put on the lower right corner of my plots a notification text string, typically citing the the “data source : date of production”

Although I can put text using

annotate!(xpos, ypos, "my text", :color)

it is presently missing some needed options for which I didn’t manage to find a solution either going through the Plots.jl documentation or searching discourse.

What I’m looking for is:

  • how to change the font used (presently by default it’s way too big)
  • how to make it right aligned.

N.B. all this is possible by using PyPlot directly, but I want to move away from that to a more Julian-like and consistent way of doing.

I’d appreciate some help.
All the best,

1 Like

annotate!(xpos, ypos, text("mytext", :red, :right, 3))
The text constructor is “magic” so the order of the various arguments isn’t important.


Thanks Mike,

  • with the gr() backend that does the trick! THANKS.

  • however when using the pgfsplots() backend (which is the one I usually employ), one cannot annotate below the x-axis, nor change the font-size

Can I bother you for how to change the font to “Courier”, “Sans” for instance (again I do not manage to extract this from the docs, nor ? or methods(text) get me any furher)?


It should all be here
The example actually uses courier.

One thing to consider if you’re using pgfplots because you’re embedding in LaTeX. Consider savefig("myfigure.tex"), the resulting figure should take fonts and stuff from the latex document.

1 Like

Here’s a more recent version of the link that is not actually dead :slight_smile:

1 Like

Your link is already dead again… current version seems to be here: Using LaTeX code · PGFPlotsX.jl