[R] cex option in the text function
paul at stat.auckland.ac.nz
Mon Jun 25 05:14:47 CEST 2001
> I am using the "text" function to write text on a graph and I am using the
> cex option to specify the size of my text. It looks like if I specify any
> value < 0.5 the size does not change. Anybody noticed that? Any help?
R can only use the fonts that are available in the system it is installed
on. This means that sometimes it has to use the nearest thing to what the
On some systems, when it does not give exactly what the user asks for, it
gives a warning. For example, the following is a transcript of a session on
my (UNIX/X11) system:
> plot(1:10, type="n")
> for (i in 1:10) text(i, i, "Hi There", cex=i/10)
1: X11 used font size 8 when 2 was requested
2: X11 used font size 8 when 4 was requested
3: X11 used font size 8 when 5 was requested
4: X11 used font size 8 when 6 was requested
5: X11 used font size 8 when 7 was requested
However, notice that this warning is only given once (i.e., if I issue the
commands again, the warnings are not repeated -- this is because the font is
To further complicate things, not all devices give this warning (e.g., my
old Windows system does not -- we should fix this if current Windows systems
still have the problem).
On the brighter side, this problem should only occur onscreen -- text
scaling should come out ok in PostScript output (because it uses scalable
Does that help to explain the effect you are seeing?
p.s. Onscreen, Hershey vector fonts should look ok too (because they are
scalable), but I have discovered that this does not work as it should -- I
am fixing this now.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help