[R] Bold greek letters using plotmath

Jim Price price_ja at hotmail.com
Tue Mar 23 23:03:01 CET 2010

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

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) 

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
[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

View this message in context: http://n4.nabble.com/Bold-greek-letters-using-plotmath-tp1679759p1679759.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list