[R-sig-Geo] Lattice PDF two polygon maps per page - help

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Apr 17 09:45:38 CEST 2009


I think you need to save the trellis objects returned by spplot:

plt1 = spplot(map1, ...)
plt2 = spplot(map2, ...)

and then plot them in a single device:

print(plt1, ..., more = TRUE)
print(plt2, ..., more = FALSE)

where you replace the ... with the relevant argument for position OR
split, read ?print.trellis for the details.
--
Edzer

Jim Burke wrote:
> I would like to print two polygon maps per
> PDF page. The following code prints each
> map on two PDF pages. The maps are small
> enough to print two on one page.
>
> MY QUESTION. How can I get these two polygon
> maps to print on ONE PAGE?
>
> I have Deepayan Sarkar's "Lattice Multivariate
> Data Visulaization with R" book and want to
> do a polygon display like the graphs in Figure
> 1.2.
>
> Using R 2.8.1 latest updates on Windows XP
>
> CODE FRAGMENT FOLLOWS:
>
> pdf(file = "myoutputfile.pdf", width=7, height=10)
>
> library(lattice)                    trellis.par.set(sp.theme())        
> spplot(tx3_sp, c("D_PCT"),
>    colorkey=list(height=1.0, width=0.6),
>    main = list(label="My first title",cex=.5),
>    line=0,
>    sp.layout = list("sp.text",coordinates(tx3_sp),
>    as.character(tx3_sp$PCT,cex=.02),
>    as.table = TRUE)
> )
> spplot(tx3_sp, c("D_TOT"),
>    colorkey=list(height=1.0, width=0.6),
>    main = list(label="My second title",cex=.5),
>    line=0,
>    sp.layout = list("sp.text",coordinates(tx3_sp),
>    as.character(tx3_sp$PCT, cex=.02),
>    as.table = TRUE),
>    newpage = FALSE
> )
> dev.off()
>
> Thanks in advance for your suggestions!
> Jim Burke
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list