[R] mysterious extra spaces appearing in expression paste

George Locke george.locke.physics at gmail.com
Tue Feb 2 20:13:44 CET 2010


Hi,

i'm trying to put a legend on some figures and they're coming out a
bit wonky.  here's an example:

a <- c(1:10)
par(mfrow=c(2,1))
plot(a,type="s",lwd=3)
leg <- c(expression(paste("data1 (",rho,"=1)")),
expression(paste("data2 (",rho,"=0.0)")))
legend("bottomright",legend=leg,col=c(1,2),lwd=3)
plot(a,type="s",lwd=3)
leg <- c(expression(paste("data1 \n(",rho,"=1)")),
expression(paste("data2 \n(",rho,"=0.0)")))
legend("bottomright",legend=leg,col=c(1,2),lwd=3, y.intersp = 2.0,adj=c(0,1.5))

the problem is that lots of extra space appears between the open
parenthesis and the rho.

what can be done?  (i'm running  version 2.10.1 (2009-12-14) on fedora 12)

Thanks!

George Locke



More information about the R-help mailing list