[R] fancy text in pairs()

Michael.Scroggie at dse.vic.gov.au Michael.Scroggie at dse.vic.gov.au
Thu May 15 03:28:03 CEST 2008


Dear List,

I'm currently trying to produce a number of pairs() plots with special
text labels in the diagonal panels giving the units for the various 
quantities.
These labels stretch across multiple lines, with the names of the 
quantities 
and the symbols for the units on separate lines. This seems to be leading 
to
problems with the justification of the text that I can't seem to work out. 


The code below gives an example of what I have in mind with some
fake data and units to illustrate. Has anyone got some ideas on how
to modify my code so that I can have both the name of the quantity and
the symbol for the unit nicely centred within the diagonal panel, one 
above the
other?

I'm running R 2.7.0 under windows XP.


#generate some fake data:
x1<-rnorm(100, 10, 1)
x2<-rnorm(100, 5, 1)
x3<-rnorm(100, 100, 2)
X<-cbind(x1, x2, x3)


#character vector of labels..
labs<-c(
    expression(paste("Pressure \n", "(kg ", m^-2,")")),
    expression(paste("Acceleration \n", "(", "m ", s^-1, s^-1,")")),
    expression(paste("Concentration \n","(", mu, g," ", L^-1,")"))
           )

#make a pairs() plot of the data.
pairs(X, labels=labs, las=1, label.pos=0.5)


Thanks for any solutions or suggestions,

Michael Scroggie.


Notice:
This email and any attachments may contain information t...{{dropped:11}}



More information about the R-help mailing list