[R] help filtering points from a scatterplot

Vining, Kelly Kelly.Vining at oregonstate.edu
Fri Feb 24 18:46:13 CET 2012

Thanks for the suggestion, Tad, but that's not quite it. That is still taking a subset of the whole data set, so I am losing some of the x("Window") values. I need to be able to retain all of the x values (column a in your example), but not plot any points above. Maybe I need to construct a blank x-y plot first with the needed range of x values, then use "points" to plot my data values? Not sure how exactly to do that...

--Kelly V.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Dallas
Sent: Friday, February 24, 2012 5:58 AM
To: r-help at r-project.org
Subject: Re: [R] help filtering points from a scatterplot

I believe this is what you want to do, though it may need tweaking.

#Make up some data
> a=seq(1,100,by=1)
> b=runif(100,0,0.5)

#Make a matrix
> matrix=cbind(a,b)

#Subset the matrix based upon values of interest
> subsetmatrix=matrix[which(b<0.1),]

#Plot values
> plot(subsetmatrix[,2]~subsetmatrix[,1],ylim=c(0,1),las=1,ylab='Explan',xlab='Window')

Hope this helps. 

View this message in context: http://r.789695.n4.nabble.com/help-filtering-points-from-a-scatterplot-tp4415833p4417247.html
Sent from the R help mailing list archive at Nabble.com.

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.

More information about the R-help mailing list