[R] Plot of set

Greg Snow Greg.Snow at imail.org
Mon Feb 21 16:25:36 CET 2011


Here is a solution using contour:

x <- y <- seq(-1.5,1.5,length=100)
z <- outer(x, y, function(x,y) x^2+y^2)

contour(x,y,z, levels=1)



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.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 . .
> Sent: Sunday, February 20, 2011 2:41 AM
> To: r-help at r-project.org
> Subject: [R] Plot of set
> 
> 
> I am in the situation where I have to make a two-dimential plot of a
> set. If I simplify my data it would be something along the lines of
> wanting to plot {x,y| x^2+y^2 < = 1}.
> I am aware of the contour and persp plot, but cannot figure out how to
> convert one of those to draw the set. I have tried to google different
> ways of plotting in R but have not been able to find a method through
> that either.
> 
> Thanks in advance
> 
> Lise
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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