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

baptiste auguie baptiste.auguie at googlemail.com
Tue Mar 20 23:09:09 CET 2012


Hi,

Have you tried geom_raster and panel.levelplot.raster respectively, if
your image has regular tiles? "grid lines" artefacts are often
reported as a bug from pdf viewers when the image is made of multiple
rectGrobs.

HTH,

baptiste

On 21 March 2012 10:57, Manuel Spínola <mspinola10 at gmail.com> wrote:
> Thank you Roman,
>
> I used ggsave, but the quality of the plot is not good. I got a "grid" all
> over the map and some of the background.
>
> Best,
>
> Manuel
>
> 2012/3/20 Roman Luštrik <roman.lustrik at gmail.com>
>
>> For lattice and ggplot2 graphics, you need to wrap the ggplot/qplot into a
>> print call. Or, you can use ggsave.
>>
>> Cheers,
>> Roman
>>
>>
>>
>> On Tue, Mar 20, 2012 at 10:41 PM, Manuel Spínola <mspinola10 at gmail.com>wrote:
>>
>>> Dear list members,
>>>
>>> How can I save a map on pdf plotted with the functions levelplot or gplot
>>> from the rasterVis package without loosing quality of the map.
>>>
>>> > class(maparaster)
>>> [1] "RasterLayer"
>>> attr(,"package")
>>> [1] "raster"
>>>
>>>
>>> pdf("mp.pdf")
>>> levelplot(maparaster)
>>> dev.off()
>>>
>>> and
>>>
>>> pdf("mpgplot.pdf")
>>> gplot(maparaster) + geom_tile(aes(fill = value))
>>> dev.off()
>>>
>>>
>>> Best,
>>>
>>> Manuel
>>>
>>> --
>>> *Manuel Spínola, Ph.D.*
>>>
>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>>> Universidad Nacional
>>> Apartado 1350-3000
>>> Heredia
>>> COSTA RICA
>>> mspinola at una.ac.cr
>>> mspinola10 at gmail.com
>>> Teléfono: (506) 2277-3598
>>> Fax: (506) 2237-7036
>>> Personal website: Lobito de río <
>>> https://sites.google.com/site/lobitoderio/>
>>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>>
>>
>> --
>> In God we trust, all others bring data.
>>
>
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspinola at una.ac.cr
> mspinola10 at gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list