Re: [R] trouble with maps

2003-07-23 Thread Ray Brownrigg
[EMAIL PROTECTED] wrote:
> On Wed, 23 Jul 2003, Deborah Swayne wrote:
> 
> > Has anyone else seen this behavior from the "maps" package?
> > 
> > map('state', fill=TRUE)
> > 
> > results in a lively mix of overlapping polygons inside a
> > map of the US, but they have no obvious relationship to
> > state boundaries.  (See attached jpeg.)
> 
Ah, this was a 'known problem' :-) first noticed in January this year,
by Ott Toomet <[EMAIL PROTECTED]>.

I suspect it is a feature of the port to R which never worked
properly.  The solution is to reverse the sign of every line number
making up the polygons in the .gon file (or alternately, reverse the
order of the line numbers there).

A 'fixed' maps package (Unix only) is available at:
ftp://ftp.mcs.vuw.ac.nz/pub/statistics/map/maps_1.1-2.tar.gz

Ray Brownrigg

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] trouble with maps

2003-07-23 Thread Roger Bivand
On Wed, 23 Jul 2003, Deborah Swayne wrote:

> Has anyone else seen this behavior from the "maps" package?
> 
> map('state', fill=TRUE)
> 
> results in a lively mix of overlapping polygons inside a
> map of the US, but they have no obvious relationship to
> state boundaries.  (See attached jpeg.)

Yes, this replicates. I think the trouble is in the part of map() where it 
makes a polygon of the lines:

if (fill) {
gonsize <- line$size
color <- rep(color, length = length(gonsize))
keep <- !is.na(color)
coord[c("x", "y")] <- makepoly(coord, gonsize, keep)
color <- color[keep]
}

and I think makepoly needs gon, not gonsize, as an argument, to stitch the 
boundary lines together in the correct order - the "interesting" effect 
seems to come from some lines not being reversed. Unfortunately, I don't 
have archival copies of earlier map() functions to check this - it could 
also be in mapgetl():

if (fill) 
coord <- mapgetl(database, line$number, xlim, ylim)

although this is less likely, because the same function is used to 
retrieve the same data when fill=FALSE too. Something has got lost in 
building the polygons, it seems! As far as I can establish, fill=TRUE did 
work in earlier versions.

> p <- map('state', region=c('penn'), resolution=0)
> plot(p, type="l")

gives the boundaries in both cases,

> pf <- map('state', region=c('penn'), fill=TRUE, resolution=0)

gives black/white "interesting" polygons, and

> plot(pf, type="l")

draws the boundary lines with wrong links to next line segents.

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] trouble with maps

2003-07-23 Thread Deborah Swayne
Has anyone else seen this behavior from the "maps" package?

map('state', fill=TRUE)

results in a lively mix of overlapping polygons inside a
map of the US, but they have no obvious relationship to
state boundaries.  (See attached jpeg.)


I reinstalled the maps and mapdata packages from
   ftp://ftp.mcs.vuw.ac.nz/pub/statistics/map/  
to see it that would help, but it doesn't.

Since our platform is an SGI (running R-1.8.0, development
version, June 25), I made sure to use mapget.c.notlinux,  
and that didn't help either.

Any thoughts?  Is there something I'm missing?

Debby

[Apologies if r-help receives this twice; I'm learning to
use a new mailer.]__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help