[R] contourplot by year
David Winsemius
dwinsemius at comcast.net
Sun Jul 11 04:18:22 CEST 2010
On Jul 10, 2010, at 5:58 PM, Sally_roman wrote:
>
> Hi - I have a dataframe with 4 variables - long, lat, temp and
> year. I would
> like to plot temperature by lat and long in contour plots by year.
> There
> are 391 data points. When I try
>
> contourplot(temp~long*lat|year,data=hake,cuts=10,labels =
> TRUE,contour =
> TRUE,pretty = TRUE,region=TRUE)
>
> I get plots with dots around by data, but not contour lines or
> filled in
> regions.
> I have also used the intrep function with image and contour which
> works
> fine, but I have to subset by data by year first before I make the
> graphs.
>
> I tried to use grid<-expand.grid(x=x,y=y) after reading some other
> questions
> on Nabble about using contourplot with irregular data points. When
> I run
> the contourplot
> contourplot(z~x*y|hake$year,data=grid,cuts=10,labels = TRUE,contour =
> TRUE,pretty = TRUE,region=TRUE)
> I get an error message in the plot: Error using packet 4 no proper
> 'z'
> matrix specified.
>
> I tried to use expand.grid(x=x,y=y,z=z),
Expand.grid(x,y) might be useful for setting up a structure but you
then need to add a z variable that is appropriate for each row of the
x-by-y grid. You do not want an x-by-y-by-z grid. Look mor closely at
the example on the help apge for contourplot. The "fit" columns is not
given as an argument to expand.grid.
> but get an error message that R
> cannot allocate vector of size 3.1 Gb.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list