[R] Mix font families in a single label?
Marc Chiarini (Tufts)
marc.chiarini at tufts.edu
Mon Aug 17 00:21:51 CEST 2009
Dear R-help community:
I have been searching for an elegant solution to the question posed in
my subject. I would like to be able to use any of the R functions like
text() or mtext() to display some text with mixed font families. For
example, a label like "huge-class background load", where the word
"huge" is in Courier and the rest is in the default family (or any other
family for that matter). I will ultimately be saving to EPS files, so I
know the correct families need to be included when I open the device.
So far I have fiddled with plotmath to no avail. I also know that I can
place the first and remaining words with separate calls to a text
function and something like strwidth() for proper positioning, but I
never quite seem to get that right. I suppose that the family needs to
be taken into account to compute the string width, and that doesn't seem
to happen. Is there an easier way that does the calculations automatically?
Any help is much appreciated.
CompSci PhD Candidate
Medford, MA 02155
More information about the R-help