[R] Bold greek letters using plotmath

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Mar 24 07:47:43 CET 2010


Plotmath does not have a bold symbol font -- R's plotting system has 
only 5 fonts (see 'font' in ?par), and bold symbol fonts are not 
commonly installed in plotting systems.

Strictly the symbols such as mu used in mathematical notation differ 
from the letters used in Greek.   You may get a good substitute using 
a Greek letter, depending on the device -- which you have not told us 
but I would guess() was windows().

Try replating mu by "\u03bc".  (I am not using Windows, but this works 
on X11() and quartz() for example.)

On Tue, 23 Mar 2010, Jim Price wrote:

>
> I'm trying to annotate some graphics using plotmath and finding out that the
> code I'm using isn't bolding the greek letters - it bolds the rest (once I
> adjusted the numerics to characters), it's just failing on the greek
> characters.
>
> Any suggestions welcomed.
>
> Jim Price.
> Cardiome Pharma Corp.
>
>
> Test code:
>
>
> plot(1:5, type = 'n')
>
>
> # The not bold version
> text(2, 2:4, cex = 2, labels = do.call(expression,
> 	unlist(list('Placebo', lapply(c(3, 6), function(.x) substitute(.x ~~ mu * g
> / kg / hr, list(.x = .x)))), recur = F)))
>
>
> # The bold version - note that the greek letter doesn't change
> text(4, 2:4, cex = 2, labels = do.call(expression,
> 	unlist(list(substitute(bold(Placebo)), lapply(as.character(c(3, 6)),
> function(.x) 
substitute(bold(.x ~~ mu * g / kg / hr), list(.x = .x)))),
> recur = F)))
>
>
>
>
>
>
>> sessionInfo()
> R version 2.10.0 (2009-10-26)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] graphics  grDevices utils     datasets  methods   stats     base
>
> other attached packages:
> [1] foreign_0.8-38     latticeExtra_0.6-1 RColorBrewer_1.0-2 lattice_0.17-26
>
> loaded via a namespace (and not attached):
> [1] grid_2.10.0  tools_2.10.0


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list