[R] help with recalling data points in a specific region of the plot

David Winsemius dwinsemius at comcast.net
Mon Aug 24 19:52:00 CEST 2009

On Aug 24, 2009, at 12:55 PM, Edward Chen wrote:

> 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 y>5?
> Thank you very much!
Your question is pretty light on specifics but assuming that you have  
columns  x and y  in a dataframe, df1, then in ordinary graphics you  
could just execute this after another plotting function has been  

with(subset(df1, x>5 & y>5), points(x,y, col="red") )

# I generally make my points smaller with cex=0.2 or cex=0.1

subset(f1, x>5 & y>5)[ , c("x","y")]
# should "recall" the values, if my wetware R interpreter is working  

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list