summary: How to overlay a geographical map on each panel in a lattice
(or Trellis), e.g., of levelplot's? Note I am not inquiring about
creating choropleth maps[,]
which Sarkar 2008 covers quite well (and which is supported by
latticeExtra::mapplot): I just want to appropriately overlay a
garden-variety boundary-line map on panel viewspaces defined by
longitude and latitude.
A relatively small, quite self-contained example follows the quote
above, in which I plot toy data in the sort of lattice layout I need ...
except that each panel lacks a map appropriate to the spatial domain. If
your competencies extend to that, your assistance would be appreciated.
TIA, Tom Roche <Tom_Roche at pobox.com>
Hello,
Your image is projected, not your panels.
Does it match what you are looking for?
wld <- map('world', xlim=c(west.lon.deg,east.lon.deg),
ylim=c(south.lat.deg,north.lat.deg),plot=FALSE)
wld <- data.frame(lon=wld$x, lat=wld$y)
state <- map('state', xlim=c(west.lon.deg,east.lon.deg),
ylim=c(south.lat.deg,north.lat.deg),plot=FALSE)
state <- data.frame(lon=state$x, lat=state$y)
sigdigs=3 # significant digits
# plot "appropriately" for atmospheric data: use
# * lattice::levelplot
# * one column, since atmospheric levels stack vertically
levelplot(
concentration ~ longitude * latitude | level,
data=data.3d.df, layout=c(1,n.lev),
levs=as.character(round(data.3d.df[['level']], 1)),
strip=FALSE,
strip.left=strip.custom(
factor.levels= # thanks, David Winsemius
as.character(signif(unique(data.3d.df[['level']]), sigdigs)),
strip.levels=TRUE,
horizontal=TRUE,
strip.names=FALSE,
# gotta shrink strip text size to fit strip width:
# more on that separately
par.strip.text=list(cex=0.5)
)
) +
xyplot(lat ~ lon, state, type='l', lty=1, lwd=0.5, col='black') +
xyplot(lat ~ lon, wld, type='l', lty=1, lwd=1, col='black')
Regards,
Pascal
Le 21/11/2012 08:40, Tom Roche a ?crit :
summary: How to overlay a geographical map on each panel in a lattice
(or Trellis), e.g., of levelplot's? Note I am not inquiring about
creating choropleth maps[,]
which Sarkar 2008 covers quite well (and which is supported by
latticeExtra::mapplot): I just want to appropriately overlay a
garden-variety boundary-line map on panel viewspaces defined by
longitude and latitude.
A relatively small, quite self-contained example follows the quote
above, in which I plot toy data in the sort of lattice layout I need ...
except that each panel lacks a map appropriate to the spatial domain. If
your competencies extend to that, your assistance would be appreciated.
TIA, Tom Roche <Tom_Roche at pobox.com>
Hello,
I think you need to launch the library 'latticeExtra'. I forgot to
mention it. Sorry.
> library(latticeExtra)
Regards,
Pascal
Le 21/11/2012 14:29, Tom Roche a ?crit :