[R] extracting x,y coordinates from a contour plot
Charles Annis, P.E.
charles.annis at statisticalengineering.com
Mon Sep 6 15:42:16 CEST 2010
Thank you, David:
I obviously didn't look hard enough. This is exactly what I need.
Charles Annis, P.E.
Charles.Annis at StatisticalEngineering.com
561-352-9699
http://www.StatisticalEngineering.com
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of David Winsemius
Sent: Monday, September 06, 2010 12:43 AM
To: Charles.Annis at statisticalengineering.com
Cc: r-help at r-project.org
Subject: Re: [R] extracting x,y coordinates from a contour plot
On Sep 5, 2010, at 11:48 PM, Charles Annis, P.E. wrote:
> Requisite info: R version 2.11.1 (2010-05-31) running on a 64 bit HP
> Windows
> 7 machine.
>
Doubt that makes much of a difference here.
> I have used contour() for several years. Now I would like to
> extract from a
> contour plot the x, y coordinates of a contour z=constant. This
> seems as
> though it would be straight-forward but I've been unsuccessful in my
> searches of CRAN.
Suggest you read the help page for contour and the pages to which it
links as well as working the examples. The answer is illustrated in
the examples on that page.
> Can anyone provide a hint?
> x <- 10*1:nrow(volcano)
> y <- 10*1:ncol(volcano)
> xy160 <- contourLines(x, y, volcano, nlevels=1, levels=160)
> str(xy160)
List of 2
$ :List of 3
..$ level: num 160
..$ x : num [1:165] 110 108 105 102 103 ...
..$ y : num [1:165] 295 300 310 320 330 ...
$ :List of 3
..$ level: num 160
..$ x : num [1:31] 270 263 262 260 260 ...
..$ y : num [1:31] 310 320 330 340 350 ...
--
David.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.
More information about the R-help
mailing list