[R] cex option in the text function

Paul Murrell paul at stat.auckland.ac.nz
Mon Jun 25 05:14:47 CEST 2001


Hi


> 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
user requests.

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)
Warning messages:
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
not reloaded).

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
fonts).

Does that help to explain the effect you are seeing?

Paul

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 mailing list