[R] How to plot two variables in the same qqnorm-plot?

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Fri Dec 8 11:50:54 CET 2006


try this:

z1 <- rnorm(100)
z2 <- rt(100, 3)
##########
q1 <- qqnorm(z1, plot.it = FALSE)
q2 <- qqnorm(z2, plot.it = FALSE)
plot(range(q1$x, q2$x), range(q1$y, q2$y), type = "n")
points(q1)
points(q2, col = "red", pch = 3)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Jenny persson" <jenny197806 at yahoo.se>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, December 08, 2006 11:30 AM
Subject: [R] How to plot two variables in the same qqnorm-plot?


>  Dear all,
>
>  I have two variables called c2 and c3 and want to plot these 
> variables in the same qqnorm-plot with two different symbols or 
> colors to distinguish them so I can easily compare the variables 
> aginst each other. How can I do in R? I only manage to do two 
> separated qqnorn-plots.
>
>  Thanks for your help,
>
>  All the best,
>  Jenny
>
>
>
>  c2=
>  -0.1545775144 -0.0601161235 -0.1454710903 
> 0.1893182564 -0.0470586789
>  -0.0740945381 -0.0041386301 
> 0.0889232833 -0.0418779055 -0.0184595989
>  -0.1116784460 0.5286719173 -0.0714560939 -0.1160750488 0.2479689612
>  -0.0255424336 -0.1802256606 -0.1436590798 
> 0.2091955894 -0.0408695231
>  -0.0097490458 0.4674886420 0.1310178029 0.2518403775
>
>  c3=
>  -0.1696564482 -0.1126714841 -0.1460504793 
> 0.1674967485 -0.0181011669
>  -0.0671367425 0.3261235871 0.0125372613 -0.0970306822 0.0066345879
>  -0.0438274488 0.8376670819 -0.1195411677 -0.0735540655 0.2999832105
>  -0.0133914650 -0.1020235781 -0.0929364933 
> 0.1909337727 -0.0198168723
>  0.0544515704 0.5744399944 0.5022208978 -0.1494894501
>
>
>
>
>
>
> ---------------------------------
>
> Stava rätt! Stava lätt! Yahoo! Mails stavkontroll tar hand om 
> tryckfelen och mycket mer! Få den på http://se.mail.yahoo.com
> [[alternative HTML version deleted]]
>
>


--------------------------------------------------------------------------------


> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list