[R-sig-Geo] Line width in sp maps

Roger Bivand Roger.Bivand at nhh.no
Wed Jul 5 12:19:20 CEST 2006


On Wed, 5 Jul 2006, Vladimir Batagelj wrote:

> 
> <<<-------- Roger Bivand-------->>>
> 
> > both for base graphics. Are you using spplot()?
> 
> Yes.

Then this is an spplot/lattice graphics question, where I'm as out of my 
depth as you are. It looks as though sp.polygon() takes arguments that are 
passed to grid.polygon(gpar()) and panel.lines(), so it is a matter of 
inding the right incantation. It looks to me as though the '...' in 
spplot.polygons doesn't make it all the way through. This would need 
fixing in code. The workaround is to use base graphics.

Roger

> I am trying to get a display of administrative units in the world
> 
> > rc <- readShapePoly("admin98/admin98.shp")
> > names(rc)
>  [1] "FIPS_ADMIN" "GMI_ADMIN"  "ADMIN_NAME" "FIPS_CNTRY" "GMI_CNTRY" 
> "CNTRY_NAME" "REGION"     "CONTINENT"
>  [9] "POP_ADMIN"  "SQKM_ADMIN" "SQMI_ADMIN" "TYPE_ENG"   "TYPE_LOC"  
> "COLOR_MAP"
> > length(rc$ADMIN_NAME)
> [1] 2604
> > rc$f = factor(sample(1:10, 2604, replace = T), labels = letters[1:10])
> > spplot(rc, "f", col.regions=brewer.pal(10, "Set3"), scales=list(draw =
> TRUE))
> 
> I get the complete picture but with thick lines.
> I tried in different ways to set the lwd parameter to spplot:
> 
> > spplot(rc, "f", col.regions=brewer.pal(10, "Set3"), scales=list(draw =
> TRUE),lwd=0.01)
> 
> > trellis.par.set(list(plot.line=list(lwd=0.01)))
> > spplot(rc, "f", col.regions=brewer.pal(10, "Set3"), scales=list(draw =
> TRUE))
> 
> > spplot(rc, "f", col.regions=brewer.pal(10, "Set3"), scales=list(draw =
> TRUE),
> + par.settings=list(plot.line=list(lwd=0.01)))
> 
> > spplot(rc, "f", col.regions=brewer.pal(10, "Set3"), scales=list(draw =
> TRUE),
> + par.settings=list(plot.polygon=list(lwd=0.01)))
> 
> I couldn't obtain thin lines.
> 
> Vlado
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list