Fw: [R] Contour plot

Petr Pikal petr.pikal at precheza.cz
Wed Feb 9 11:23:44 CET 2005


Hi Darius


On 8 Feb 2005 at 17:43, dhkblaszyk at zeelandnet.nl wrote:

> I understand that I need to have a (in this case) square matrix with
> all the data. But the question now is;
> 
> - can the contourplot not interpolate the missing values
> 
> or alternatively
> 
> - I have fit a model to the z data (z = 100 + 0.5x + 0.5y). How can I
> make from this model a "square" matrix z to make a contour plot?


Will

x<-1:10
y<-1:10
z <- outer(x,y,function(x,y) 100 + 0.5*x + 0.5*y)
contour(x,y,z)

work as you wish?
Cheers
Petr


> 
> Kind regards, Darius Blaszijk
> 
> ----- Original Message -----
> From: "Achim Zeileis" <Achim.Zeileis at wu-wien.ac.at>
> To: <dhkblaszyk at zeelandnet.nl>
> Cc: <r-help at stat.math.ethz.ch>
> Sent: Tuesday, February 08, 2005 1:51 AM
> Subject: Re: [R] Contour plot
> 
> 
> > On Tue, 8 Feb 2005 01:15:06 +0100 dhkblaszyk at zeelandnet.nl wrote:
> >
> > > Hello,
> > >
> > > I would like to make a contourplot of the following data;
> > >
> > > > x <- 1:10
> > > > y <- 1:10
> > > > z <- 100:110
> > >
> > > By doing >contour(x,y,z) I get the following error;
> > >
> > > "Error in contour.default(x, y, z) : no proper `z' matrix
> > > specified"
> > >
> > > How do I fix this??
> >
> > x and y specify a grid and thus z must provide a value for each
> > combination of the x's and y's! For example:
> >   x <- y <- 1:10
> >   contour(x, y, outer(x, y))
> > Also look at
> >   outer(x, y)
> > and read ?contour.
> >
> > Z
> >
> > > Kind regards, Datius Blaszijk
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html
> > >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list