[R] xyz-contour plot (irregular grid)

David Carlson dcarlson at tamu.edu
Fri Nov 22 16:30:50 CET 2013

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

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)", 
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()?
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
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible

More information about the R-help mailing list