Assuming you have something like:
d=1:10 plot(d,type="l")
and you donβt need different colors for the numerator and denominator, you can do this with a single line (including text hint at @CarlWitthoft):
text(0.5*max(d), 0.9*max(d), expression(Result == frac(Green, Blue)), cex=1.5)
but there is no easy way to change the color of the numerator and denominator. So the clunky way is to configure each item separately:
text(0.4*max(d), 0.9*max(d), "Result =", cex=1.5) text(0.55*max(d), 0.93*max(d), "Green", col="green", cex=1.5) text(0.55*max(d), 0.87*max(d), "Blue", col="blue", cex=1.5) segments(0.5*max(d), 0.9*max(d), 0.6*max(d), 0.9*max(d))
which I know, this is not what you really want, but just in case there will be no better hack ...
source share