[R-sig-Geo] Problem with points.geodata and plot.geodata
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Mon Oct 20 08:35:40 CEST 2008
2008/10/20 Rubén Roa-Ureta <rroa at udec.cl>:
> Hi ComRades,
>
> The functions points.geoadata and plot.geodata have an underisable behavior
> with the limits of the X axis of the plot, as shown by the toy example
> below. The range covered by the X axis is too wide. Setting specific limits
> with xlim in, for example points.geoadata, doesn't solve the problem.
> Does anybody knows of a solution or a way around this feature.
When plotting spatial data it is desirable to see the points as they
would look on a map. Your data has a small X-range compared to it's
Y-range, and so when you plot it as spatial data it is laid out on a
thin, tall rectangle. This is how it would look on a map with regular
cartesian coordinates.
If you plot something in R that isn't spatial data then R stretches
one axis to fill the space. This is the right thing to do if you don't
have a spatial relationship between the axes, such as when plotting
age against weight.
Note that keeping this 1:1 ratio of X to Y axes (the 'aspect ratio')
for spatial data means that distances between points are preserved.
This is generally important for spatial data since your concern is
often distances and relationships to other points. If you stretched
the plot out then you would make points above and below point M closer
than points left and right.
If you really want to plot this data in a filled square manner, just
get the coordinates and plot:
> plot(z1$coords)
you can control the aspect ratio of a plot with the asp option (see help(par))
> plot(z$coords,asp=1)
- reproduces the aspect ratio of the default geodata and sp plotting.
Barry
More information about the R-sig-Geo
mailing list