[R] problem with Hershey fonts
ray at mcs.vuw.ac.nz
Tue Jul 26 12:51:20 CEST 2005
This was reported to me by a colleague in China, so I may not be
reproducing exactly what they are seeing (which I suspect is rw2011), but
this is what I see:
system i386, netbsdelf
If the 'vfont' argument to one of the text-drawing functions
('text', 'mtext', 'title', 'axis', and 'contour') is a character
vector of length 2, Hershey vector fonts are used to render the
The other useful escape sequences all begin with '\\'. These
are described below. Remember that backslashes have to be
doubled in R character strings, so they need to be entered
with _four_ backslashes.
> plot(runif(100)) # to get something on the screen
> text(0, 1, '\\Re', vfont=c('serif', 'plain')) # works
> title(main = '\\Re', vfont=c('serif','plain')) # doesn't work, and...
parameter "vfont" could not be set in high-level plot() function
> mtext('\\Re', 2, vfont=c('serif','plain')) # doesn't work, but...
Hershey fonts not yet implemented for mtext() in: mtext(text, side, line, outer, at, adj, padj, cex, col, font,
> axis(3, at=50, tick=F, labels='\\Re', vfont=c('serif','plain')) # doesn't work
Now at least mtext() 'redeems' itself with its Warning, but title()
contradicts the help(Hershey), and axis() just gets it wrong by printing
the characters "\Re" (or "\\Re" when the string is specified as
'\\\\Re' as alluded to in the Hershey documentation - but somewhat
contradicted by the success of the text() call above).
Now perhaps the problem is just with the Hershey documentation (or my
reading of it), but I don't know what is supposed to work. Or is there
some combination that I haven't tried?
More information about the R-help