Skip to content
Back to formatted view

Raw Message

Message-ID: <027001cee797$d3185bf0$794913d0$@tamu.edu>
Date: 2013-11-22T15:30:50Z
From: David L Carlson
Subject: xyz-contour plot (irregular grid)
In-Reply-To: <CAPr7RtXG-+mfUef7KFcduwXM=-vn=-S3jtROc7cW88a1nz1e9w@mail.gmail.com>

I'm not sure if there is a single function, but a quick script
would look something like this and would be easily adjusted

attach(mtcars)
mtcars.ls <- loess(mpg~wt*hp)
wtg <- seq(min(wt), max(wt), length.out=50)
hpg <- seq(min(hp), max(hp), length.out=50)
grid <- expand.grid(wt=wtg, hp=hpg)
mpg.fit <- predict(mtcars.ls, grid)
contour(wtg, hpg, mpg.fit, xlab="Weight (1,000 lbs)", 
  ylab="Horsepower")
points(wt, hp, pch=20)

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of ivo welch
Sent: Thursday, November 21, 2013 10:35 PM
To: r-help
Subject: [R] xyz-contour plot (irregular grid)

Dear R users:  before I try to undertake my own rewrite, has
anyone already
written a contour function that does not require a regularly
spaced grid,
preferably plot.contour(x,y,z,...)?

(it would be nice if it were based on loess() and plot()?
further
annotations, changes, etc., would then be easier.)

sincerely, /iaw

----
Ivo Welch (ivo.welch at gmail.com)

	[[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.