From: <jgarcia_at_ija.csic.es>

Date: Tue, 18 Mar 2008 14:31:59 +0100 (CET)

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. Received on Tue 18 Mar 2008 - 13:45:04 GMT

Date: Tue, 18 Mar 2008 14:31:59 +0100 (CET)

There is another solution, which depending on the resolution and amount of
your data may be useful. You can find through interpolation the corners of
four coordinates around any data point that define a four sides polygon.
This grid so created does not need to be regular. Then, you can simple
call polygon() to draw each polygon whose color corresponds to the value
in related data set. This has worked perfectly for me.
regards,

Javier

> Costas Douvis <cdouvis <at> geol.uoa.gr> writes:

*>
**>>
**>> Hi everyone
**>>
**>> I have a matrix (let's say that it contains the values of elevation) and
**>> want to plot its values on a map using a function such as image.plot or
**>> filled.contour. The problem is that my grid is not rectilinear, it is
**>> bended. Here is an example
**>>
**> (example removed)
**>>
**>> All 3 matrices have dimensions 20x25. How can I plot elev values in the
**>> grid points defined by lat and lon?
**>
**> You can flatten all three to triplets of (x, y, z) values, and colour-code
**> the points, which, as you say, do not form a grid. image() and friends
**> require either a matrix treated as a grid, or a list with the x and y
**> margins and z as a matrix.
**>
**> Since these are not in a regular grid, the usual approach is to
**> interpolate,
**> perhaps using interp() in the akima package, or using other methods of
**> your
**> choice, so that you can plot the interpolated values on a regular grid.
**>
**> If you are considering plotting a grid with data based on geographical
**> coordinates on a map in projected coordinates, the input rectangular
**> cells can be projected, using object classes defined in the sp package,
**> and functions provided in the same package, with projection using
**> spTransform() methods in the rgdal package.
**>
**> Perhaps the R-sig-geo list would be more suited to your question?
**>
**> Roger Bivand
**>
**>>
**>
**> ______________________________________________
**> 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.
**>
*

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. Received on Tue 18 Mar 2008 - 13:45:04 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Tue 18 Mar 2008 - 14:00:24 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*