On 14/01/2012 10:33 a.m., Dimitri Liakhovitski wrote:
Somewhat related question out of curiousity:
Does anyone know how often the list of the counties and county names
is updated in this package? Or is it done "centrally" for all packages
that deal with US counties?
Thanks!
Dimitri
Well, I would hazard a guess that the package maintainer would know :-)
The answer to your first question is "As and when the package maintainer
is informed of errors or changes".
The answer to your second question is "No."
Ray
On Fri, Jan 13, 2012 at 3:41 PM, Ray Brownrigg
<ray.brownr...@ecs.vuw.ac.nz> wrote:
On 14/01/2012 8:04 a.m., Sarah Goslee wrote:
On Fri, Jan 13, 2012 at 1:52 PM, Dimitri Liakhovitski
<dimitri.liakhovit...@gmail.com> wrote:
Just to clarify, according to help about the "fill" argument:
logical flag that says whether to draw lines or fill areas. If FALSE,
the lines bounding each region will be drawn (but only once, for
interior lines). If TRUE, each region will be filled using colors from
the col = argument, and bounding lines will not be drawn.
We have fill=TRUE - so why are the county borders still drawn?
Thank you!
Dimitri
This prompted me to check the code:
if fill=TRUE, map() calls polygon()
if fill=FALSE, map() calls lines()
But polygon() draws borders by default.
plot(c(0,1), c(0,1), type="n")
polygon(c(0,0,1,1), c(0,1,1,0), col="yellow")
To not draw borders, the border argument is provided:
plot(c(0,1), c(0,1), type="n")
polygon(c(0,0,1,1), c(0,1,1,0), col="yellow", border=NA)
But that fails in map():
map('county', 'iowa', fill=TRUE, col=rainbow(20), border=NA)
Error in par(pin = p) :
invalid value specified for graphical parameter "pin"
because border is used as a named argument in map() already, for setting
the
size of the plot area, so there's no way to alter the border argument
to polygon.
Coincidentally, I became aware of this just recently. When the maps package
was created (way back in the "'new' S" era), polygon() didn't add borders,
and that is why ?map states that fill does not add borders. A workaround is
to change the map() option border= to myborder= (it is then used twice in
map()).
The work-around I suggested previous (lty=0) seems to be the only
way to deal with the problem.
In fact I believe there is another workaround if you don't want to modify
the code; use the option resolution=0 in the map() call. I.e. try (in
Sarah's original Iowa example):
map('county', 'iowa', fill= TRUE, col = classcolors[countycol],
resolution=0, lty=0)
This ensures that the polygon boundaries match up.
I'll fix the border issue in the next version of maps (*not* the one just
uploaded to CRAN, which was to add Cibola County to NM).
Ray Brownrigg
Sarah
______________________________________________
R-help@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.