[R] Legend/Substitute/Plotmath problem

Johannes Graumann graumann at caltech.edu
Sat Oct 23 20:04:25 CEST 2004


Hello,

I seem unable to construct a legend which contains a substitution as
well as math symbols. I'm trying to do the following:

strain2 <- "YJG48"

legend.txt <- c(
	substitute(
		strain *
		%==% *
		"YJG45, rpn10" *
		%Delta%,
		list(strain=strain2)
	),
	"Verhulst/Logistic",
	"Malthus"
)
legend(
	100,2.5,
	legend.txt,
	cex=0.75,
	bty="n",
	pch=c(20,NA,NA),
	lty=c(NA,1,2)

I derived this from the following "text" command which works, 

text(
	160,2.2,
	cex=0.5,
	adj=0,
	substitute(
		OD[600][~nm] * 
		" of 2 at " *
		time2_2 *
		" min" 
		%~~% 
		time2h_2 * 
		" h",
		list(
			time2_2=round(time2_2,digits=0),
			time2h_2=round(time2_2/60,digits=1)
		)
	)
)

But I can't get it to work in the context of "legend".
Any hints/ideas?

Thanks, Joh




More information about the R-help mailing list