Font of annotations?

dear Plots wizards—how do I set the font (size) of annotations?

using Plots
y= 2:20; x=2:20; f(x,y)=x+y;
annotations= [ (x[i],y[j],round(f(x[i],y[j]),digits=2)) for i=1:length(x) for j=1:length(y)];
plot( ; annotations= annotations, xlim=[first(x)-1,last(x)+1], ylim=[first(y)-1,last(y)+1] )


I got this from the docs for plots.

I changed the last element of each tuple to be a Plots.text object in in the way I wanted it.

t = [(x[1], x[2], text(x[3], 5) for x in annotations]
plot( ; annotations= t, xlim=[first(x)-1,last(x)+1], ylim=[first(y)-1,last(y)+1])

this is interesting. we are using Plots.jl and not PyPlots, but the docs were still helpful. I did not realize that I should look there…

This script is missing a closing parenthesis in the line defining t. It should be:

t = [(x[1], x[2], text(x[3], 5)) for x in annotations]
1 Like