[R-sig-Geo] how to hange the size of raster maps

Adam Sparks adamhsparks at gmail.com
Wed Aug 22 14:17:43 CEST 2012


Dear Agus,
?png indicates bg="transparent in png() is supported when exporting png files.

That should give you a transparent background as desired.

> <snip>
> However, despite this script worked for plotting a phylogenetic tree with transparent background, i am still not able to generate a raster plot with transparent background.
>
> Many thanks!
> Agus
>
> 2012/7/25 Adam Sparks <adamhsparks at gmail.com>
>>
>> Dear Agus,
>> I'd suggest using the pdf() or png() functions in your script, rather than relying on RStudio's exporting.
>>
>> This way you can specify the size.
>>
>> best,
>> Adam
>>
>>
>>
>> On Wed, Jul 25, 2012 at 8:36 AM, Agus Camacho <agus.camacho at gmail.com> wrote:
>>>
>>> Dear all,
>>>
>>> I am trying to change the size to raster maps generated in R. However, the
>>> differently layers separate when i do this.
>>> Any body knows if its possible and how to avoid this?
>>> Thanks
>>> There it goes an reproducible example
>>>
>>> alt <- getData('alt', country='CHE')
>>> slope <- terrain(alt, opt='slope')
>>> aspect <- terrain(alt, opt='aspect')
>>> hill <- hillShade(slope, aspect, 40, 270)
>>> plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
>>> plot(alt, col=rainbow(25, alpha=0.35), add=TRUE)
>>>
>>> Then, use image export or save in pdf, or zoom options in Rs tudio to
>>> change the size of the file.
>>>
>>> Thanks in advance.
>>> Agus
>>>
>>> --
>>> Agustín Camacho Guerrero.
>>> Doutorando em Zoologia.
>>> Laboratório de Herpetologia, Departamento de Zoologia, Instituto de
>>> Biociências, USP.
>>> Rua do Matão, trav. 14, nº 321, Cidade Universitária,
>>> São Paulo - SP, CEP: 05508-090, Brasil.
>>>
>>>         [[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
>>>
>>
>>
>>
>> --
>> --
>> Adam Sparks
>> Plant Pathologist and GIS Specialist
>> IRRI
>> DAPO Box 7777, Metro Manila, Philippines
>> ph: +63(2) 580-5600
>>
>>
>
>
>
> --
> Agustín Camacho Guerrero.
> Doutorando em Zoologia.
> Laboratório de Herpetologia, Departamento de Zoologia, Instituto de Biociências, USP.
> Rua do Matão, trav. 14, nº 321, Cidade Universitária,
> São Paulo - SP, CEP: 05508-090, Brasil.
>



--
--
Adam Sparks
Plant Pathologist and GIS Specialist
IRRI
DAPO Box 7777, Metro Manila, Philippines
ph: +63(2) 580-5600



More information about the R-sig-Geo mailing list