[R] making multiple lines using qqplot
ilai
keren at math.montana.edu
Fri Feb 10 15:11:17 CET 2012
Melissa,
par(new=T) works as many times as you use it. You don't provide data,
but (assuming it is not NULL) more likely your n=500 qqplot was just
obscuring the points of the n=50 plot.
Reverse the order (i.e. qqplot 500 first, 50, 5 last) and see if all
three are there (as there are more 500 you should still see green on
the extremes).
Second, you say you want "lines" but used pch=20. replace with
type='l' to get lines (may also help with your main problem). If you
want to stick with points and your device supports it, you can
consider semi-transparent colors.
Cheers
On Thu, Feb 9, 2012 at 9:00 PM, Melrose2012
<melissa.patrician at stonybrook.edu> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list