[R] help with recalling data points in a specific region of the plot
jrkrideau at yahoo.ca
Mon Aug 24 19:21:00 CEST 2009
I am assuming that you want to desplay all the data and highlight the subset. Set up a vector to indicate the breakdown of the data and you can do it fairly easily in ggplot2 if you treat the vector as a factor.
mydata <- data.frame(x=1:21, y= -10:10)
z <- ifelse(mydata[,1]>5 & mydata[,2] >5, 1, 0) # identify points >5
mydata <- data.frame(mydata, z)
ggplot(mydata, aes(x=x, y=y, colour= factor(z))) + geom_point()
--- On Mon, 8/24/09, Edward Chen <edchen51 at gmail.com> wrote:
> From: Edward Chen <edchen51 at gmail.com>
> Subject: [R] help with recalling data points in a specific region of the plot
> To: r-help at r-project.org
> Received: Monday, August 24, 2009, 12:55 PM
> Hi all,
> Is there a quick way to display or recall data points from
> a specific region
> on the plot? For example I want the points from x>5 and
> Thank you very much!
> Edward Chen
> [[alternative HTML version deleted]]
> R-help at r-project.org
> mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
Looking for the perfect gift? Give the gift of Flickr!
More information about the R-help