[R-sig-eco] Plotting community data in map

Bede-Fazekas Ákos bfalevlist at gmail.com
Wed Apr 25 07:23:18 CEST 2018


Dear Thiago,

I don't know the type and values of your data, but let's say that 
endemism_values is a numeric vector containing positive integers.
In this case you can use this formula to produce the desired colors:
heat.colors(max(endemism_values))[endemism_values]
So this should work:
symbols(coords, bg =heat.colors(max(endemism_values))[endemism_values], 
circles=endemism_values, inches = .5, add = T)

HTH,
Ákos Bede-Fazekas
Hungarian Academy of Sciences


2018.04.25. 6:09 keltezéssel, Thiago A. Pires írta:
> Hi Erin,
>
> Thanks for you response.
> I tried it but, fg gives colors to a symbols border and bg fill it with
> colors.
> The thing is, while the circles gives a radius to symbols proportionally to
> the endemism values (I checked and it's correct), the fg or bg don't seems
> to correctly follows the values.
> And this is where I'm stuck. Any other ideias??
>
> Cheers,
> T.
>
>
>
> Thiago A. Leão Pires
> Ph.D. student in Ecology - UNICAMP
> Collaborator Researcher - UNIFESP
> Visitor Ph.D. student - ANU
> <http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4298681Z0>[image:
> thiagoaugustopires.wix.com/naturevisions]
> <http://www.thiagoaugustopires.wix.com/naturevisions> [image: Skype ID:
> thiago.augusto.pires] <+Skype+ID:+thiago.augusto.pires>
> <https://www.researchgate.net/profile/Thiago_Leao-Pires>
>
> 2018-04-24 23:36 GMT-03:00 Erin Frolli <frolli.erin at gmail.com>:
>
>> Hi Thiago,
>> Did you try using fg instead or fg with bg? Looks like in the R docs that
>> the color for the symbol is fg.
>> https://www.rdocumentation.org/packages/graphics/
>> versions/3.4.3/topics/symbols
>>
>> Cheers,
>> Erin
>>
>> On Tue, Apr 24, 2018 at 7:17 PM, Thiago A. Pires <
>> pires.thiagoaugusto at gmail.com> wrote:
>>
>>> ​Hi Folks,
>>>
>>> I'm trying to plotting endemism data into a map, and I would like take the
>>> symbol color for each sample follow a gradient of endemism values for this
>>> sample, like a heat map, then higher values would results in reddish
>>> colors
>>> and lower values to yellowish colors. I tried several variation in the
>>> code, changing colors and values structure, but is not working so far. Any
>>> ideas??​
>>>
>>> ​R code:
>>>> map("world", col="black", fill=F)​
>>> ​> symbols(coords, bg =heat.colors(endemism_values), circles=
>>> endemism_values, inches = .5, add = T)
>>>>>>
>>> ​Thanks
>>>
>>> Cheers,
>>>
>>>>>> Thiago A. Leão Pires
>>> Ph.D. student in Ecology - UNICAMP
>>> Collaborator Researcher - UNIFESP
>>> Visitor Ph.D. student - ANU
>>> <http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4298681Z0
>>>> [image:
>>> thiagoaugustopires.wix.com/naturevisions]
>>> <http://www.thiagoaugustopires.wix.com/naturevisions> [image: Skype ID:
>>> thiago.augusto.pires] <+Skype+ID:+thiago.augusto.pires>
>>> <https://www.researchgate.net/profile/Thiago_Leao-Pires>
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-ecology mailing list
>>> R-sig-ecology at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>>
>>
>>
>> --
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> *Erin Frolli, M.S.*
>> Software Engineer / Data Scientist
>>
>> San Fransisco, CA
>> 530.251.7172
>> Personal Website <https://sites.google.com/view/erinfrolli/about>
>>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list