I have two vectors x and y, which I would like to plot against each other. I am also displaying other data in this plot. However, I have about 1 million points to plot, and just plotting them x againt y is not very informative. What I'd like to do is to do sort of a continuous box plot. My x values goes from -1 to 1 and my y values from 0 to 1, so I?d like to plot the median and quantiles, and possibly also all of the outliers somehow. Are there any facilities in R for doing something like this, or would I need to do this the hard coded way? Thankyou very much for your help! Karin -- Karin Lagesen, PhD student karin.lagesen at medisin.uio.no http://folk.uio.no/karinlag
Hi Karin, Here is a way to do that: size=10000 x<-rnorm(size) y<- runif(size)*x+runif(size) x.breaks <- seq(min(x),max(x),length=50) x.grps <- findInterval(x,x.breaks,all.inside=TRUE) boxplot(y~x.grps) You can adapt any numbers and boxplot options to what suits your data Another way is to use the bivariate bagplot (google "R bagplot") if there is evidence of a bivariate undelrying distribution HTH, Eric 2007/10/1, Karin Lagesen <karin.lagesen@medisin.uio.no>:> > > > I have two vectors x and y, which I would like to plot against each > other. I am also displaying other data in this plot. However, I have > about 1 million points to plot, and just plotting them x againt y is > not very informative. What I'd like to do is to do sort of a > continuous box plot. > > My x values goes from -1 to 1 and my y values from 0 to 1, so I´d like > to plot the median and quantiles, and possibly also all of the > outliers somehow. Are there any facilities in R for doing something > like this, or would I need to do this the hard coded way? > > Thankyou very much for your help! > > Karin > -- > Karin Lagesen, PhD student > karin.lagesen@medisin.uio.no > http://folk.uio.no/karinlag > > ______________________________________________ > R-help@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. >-- Eric Lecoutre Consultant - Business & Decision Business Intelligence & Customer Intelligence [[alternative HTML version deleted]]
Here are a couple of things that might help: Look at the hexbin package (I think it is on bioconductor rather than cran) Look at the quantreg package (for estimating the quantiles to plot) Look at the running and wapply functions in the gtools package for another option to estimate the quantiles. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Karin Lagesen > Sent: Monday, October 01, 2007 2:32 AM > To: r-help at r-project.org > Subject: [R] "continuous" boxplot? > > > > I have two vectors x and y, which I would like to plot > against each other. I am also displaying other data in this > plot. However, I have about 1 million points to plot, and > just plotting them x againt y is not very informative. What > I'd like to do is to do sort of a continuous box plot. > > My x values goes from -1 to 1 and my y values from 0 to 1, so > I?d like to plot the median and quantiles, and possibly also > all of the outliers somehow. Are there any facilities in R > for doing something like this, or would I need to do this the > hard coded way? > > Thankyou very much for your help! > > Karin > -- > Karin Lagesen, PhD student > karin.lagesen at medisin.uio.no > http://folk.uio.no/karinlag > > ______________________________________________ > 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. >
Karin, I like to use bagplots in these cases where there are a lot of cases and scatter plots become one big smudge. See http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/bagplot/bagplot.pdf And some further examples on slides 36 - 39 of http://www.porzak.com/JimArchive/JimPorzak_CIwithR_useR2006_tutorial.pdf -- HTH, Jim Porzak Responsys, Inc. San Francisco, CA http://www.linkedin.com/in/jimporzak On 10/1/07, Karin Lagesen <karin.lagesen@medisin.uio.no> wrote:> > > > I have two vectors x and y, which I would like to plot against each > other. I am also displaying other data in this plot. However, I have > about 1 million points to plot, and just plotting them x againt y is > not very informative. What I'd like to do is to do sort of a > continuous box plot. > > My x values goes from -1 to 1 and my y values from 0 to 1, so I´d like > to plot the median and quantiles, and possibly also all of the > outliers somehow. Are there any facilities in R for doing something > like this, or would I need to do this the hard coded way? > > Thankyou very much for your help! > > Karin > -- > Karin Lagesen, PhD student > karin.lagesen@medisin.uio.no > http://folk.uio.no/karinlag > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]