[R-sig-Geo] drawing order in spplot and Line width in sp maps
Mikhail Titov
mlt at gmx.us
Sat Mar 30 06:12:12 CET 2013
Hi, All!
I know I'm excavating an old thread[1] (and top posting) but that is
exactly what bugs me.
I am surprised to see that I can't pass lwd directly to spplot's main
plot and not extra layouts. I can pass lwd to sp.polygons but not to
spplot directly :( Here is an incomplete snippet showing what I've tried
,----[ How do I change line width of shp polygons supplied to spplot? ]
| spplot(shp, names(d), col="grey80", lwd=5, cuts=5,
| # par.settings = simpleTheme(lwd=3),
| par.settings = list(superpose.polygon = list(lwd=5)),
| panel = function(...) {
| # panel.polygonsplot(..., lwd=3)
| panel.polygonsplot(...)
| sp.panel.layout(list(l.wshd, l.streams, l.struc))
| if (panel.number()==1) {
| sp.panel.layout(list(l.north, l.scale.bar, l.scale.text))
| }
| },
| colorkey = list(
| labels=list(
| at = labelat,
| labels = labeltext
| )
| ),
| names.attr=droplevels(unique(rest$case)),
| col.regions=rev(greens(14, .6))[-1])#rev(heat.colors(100)))
`----
I see that lwd for my layouts apply well, e.g., for l.wshd & l.streams
in the example above. However I can't seem to figure out how to make shp
lines thinner. I do have several variables to plot on a few panels.
Did I miss something?
P.S. Not quite related question but how does levelplot (?) estimates
color scale labels? If I leave colorkey alone, I get misplaced labels
provided cuts=5. For now, I do something like
,----[ Dirty fix for ticks & label alignment ]
| dd.rng <- range(unlist(dd), finite=TRUE)
| delta <- diff(dd.rng)
| labelat <- seq(dd.rng[1] - delta*.07, dd.rng[2] + delta*.07, length.out=7)
| labeltext <- format(exp(labelat), digits=2)
`----
I feel like there is almost a standard function for that but I can't
recall its name. Would you mind reminding if there is any?
On Mon, Jul 10, 2006 at 2:47 AM, "Edzer J. Pebesma" <e.pebesma at geo.uu.nl> wrote:
> Duncan Golicher wrote:
>> Great. Thanks so much. It was obvious really.
>> You also seem to have come up with one solution to the line width
>> question asked a couple of days ago, as this works.
>>
>> spplot(chisgrid, "dem", panel = function(x,y, ...){
>> panel.gridplot(x,y,...)
>> sp.polygons(municipios, col=1,fill=0,lwd=3,lty=2)
>> })
>>
>>
>>
> Yes, or:
>
> spplot(chisgrid, "dem", sp.layout=list("sp.polygons", municipios, col=1,
> fill=0, lwd=3, lty=2, first=F))
Footnotes:
[1] https://stat.ethz.ch/pipermail/r-sig-geo/2006-July/001174.html
--
Mikhail
More information about the R-sig-Geo
mailing list