[R] Using bold font with bquote

Jonathan R. Blaufuss blaufusj at carleton.edu
Wed Aug 12 18:36:39 CEST 2009


I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next
to the numeric text of the standard deviation calculation that I am performing.
I have been able to successfully turn the sigma symbol and numeric output the color blue,
but when I try to change the font of the text to bold, R doesn't seem to recognize the "font="
command in the same way here as it does with "col=". (My code is below)

	set.seed(1)
	Data=rnorm(100,sd=10000)
	plot(density(Data))
	text(25000,0.00003,
		bquote(sigma==.(mySigma),
		list('mySigma'=format(round(sd(Data),digits=3),big.mark=","))),
		col="blue")

After searching the help files I've tried using the expression command with "bold()" as well
as inserting "font=2" after the color command. However, I can't seem to get it to work. 

Can someone please point me to a resource that will help me figure this out?

Thank You,

Jonathan




More information about the R-help mailing list