[R] making multiple lines using qqplot

Melrose2012 melissa.patrician at stonybrook.edu
Fri Feb 10 05:00:23 CET 2012


Hi Everyone,

I want to make 3 lines on the same graph (not as subplots, all in the same
window, one on top of each other) and I want them to be quantile-quantile
plots (qqplot).  Essentially, I am looking for the equivalent of Matlab's
"hold on" command to use with qqplot.  I know I can use 'points' or 'lines',
but these do not give me a qqplot (only appear to work as scatter plots).  I
found the syntax 'par(new=TRUE)' but that only seems to work for two lines,
not for three.

My script currently looks like:

qqplot(nq.n5,tq.n5,col="red",xlab="Normal Distribution Quantiles",ylab="t
Distribution Quantiles",main="Quantile-Quantile Plot of Normal vs
t-Distribution for Various Sample Sizes",pch=20)
par(new=TRUE)     
qqplot(nq.n50,tq.n50,col="blue",xlab="",ylab="",pch=20).
par(new=TRUE)     
qqplot(nq.n500,tq.n500,col="green",xlab="",ylab="",pch=20)
legend("topleft",c("n=5","n=50","n=500"),fill=c("red","blue","green"))

I realize that this only plots the first and the third qqplot because by
doing par(new=TRUE) again, it gets rid of the middle one.  I don't know how
to get around this and get all 3 lines on the same plot.

Can anyone please help me with this syntax?

Thank you very much for your time and advice!

Cheers,
Melissa 

--
View this message in context: http://r.789695.n4.nabble.com/making-multiple-lines-using-qqplot-tp4375273p4375273.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list