[R-sig-Geo] Saving plot as PDF from functions levelplot and gplot from rasterVis package

Stephen Sefick sas0025 at auburn.edu
Fri Mar 23 02:14:21 CET 2012


ggplot and lattice require that you print the output.

 pdf("mpgplot.pdf")
a <- gplot(maparaster) + geom_tile(aes(fill = value))
print(a)
dev.off()

HTH

Stephen

On Thu 22 Mar 2012 11:11:56 AM CDT, Manuel Spínola wrote:
> Thank you very much Paul,
>
> My problem now is with the output from gplot (rasterVis, ggplot2), the
> problem with levelplot was solved by the suggestion from Oscar Perpiñán.
>
> The map is at:
> https://docs.google.com/open?id=0B5pDw_grXll8a21uQzB5ZlRULWl3ZWZxdU44b2Nvdw
>
> mapa = read.asc("Ectophylla_alba.asc" ,gz=FALSE)
> image(mapa)
>
> write.asc(mapa, "mapar")
>
> maparaster = raster("mapar.asc")
>
> pdf("mpgplot.pdf")
> gplot(maparaster) + geom_tile(aes(fill = value))
> dev.off()
>
> Also, using ggsave (ggplot2) did not solve the problem.
>
> Best,
>
> Manuel
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0025 at auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are 
so little or so large that all they really do for us is puff us up and 
make us feel like gods.  We are mammals, and have not exhausted the 
annoying little problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal 
science."

                              -Robert Gentleman



More information about the R-sig-Geo mailing list