[R] Highlighting points in a quantile plot for different values of a second column
Peter Ehlers
ehlers at ucalgary.ca
Sat Feb 13 22:33:07 CET 2010
Saptarshi Guha wrote:
> Hello,
> I have the following data frame, using lattice and qqmath, how do I display the
> quantile plot (e.g distribution = qunif), but highlight the f==TRUE and f==FALSE
> differently?
>
> library(lattice)
> pp <- function(n) ((1:n)-0.5)/n
>
> x=data.frame(x=runif(20),f=sapply(runif(20),function(r) r>0.5))
>
> I would like a single curve, the following example displays two curves.
>
> qqmath(~x,groups=f,data=x,distribution=qunif,f.value=pp)
>
Here's one way:
qqmath(~x, data=x, type='b',
col=ifelse(x$f, 2, 4),
pch=ifelse(x$f, 17, 19),cex=2)
-Peter Ehlers
>
>
> Thank you
> Saptarshi
>
> ______________________________________________
> 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.
>
>
--
Peter Ehlers
University of Calgary
More information about the R-help
mailing list