using the same legend for different scenarios in sf plots

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

using the same legend for different scenarios in sf plots

Paulo Flores Ribeiro
Hello,
I want to compare the spatial distribution of a variable in 7 different
scenarios by running the same plot code successively 7 times (within sf
package), each time changing the values of the variable for each
scenario. In each run, I copy-paste the map into a word document. In the
end, I want to visually compare the 7 maps, but for that I need the
scale range of the legend values to be the same on the seven maps
(including the colour ramp).
How to force the scale interval (and the corresponding colour ramp) to
be the same on the seven maps, within the sf package?
Thanks,
PauloFR


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: using the same legend for different scenarios in sf plots

edzer
With the breaks argument you can specify the numbers at which colors break.

On 2/19/20 3:05 PM, Paulo Flores Ribeiro wrote:

> Hello,
> I want to compare the spatial distribution of a variable in 7 different
> scenarios by running the same plot code successively 7 times (within sf
> package), each time changing the values of the variable for each
> scenario. In each run, I copy-paste the map into a word document. In the
> end, I want to visually compare the 7 maps, but for that I need the
> scale range of the legend values to be the same on the seven maps
> (including the colour ramp).
> How to force the scale interval (and the corresponding colour ramp) to
> be the same on the seven maps, within the sf package?
> Thanks,
> PauloFR
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48149 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

pEpkey.asc (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using the same legend for different scenarios in sf plots

Paulo Flores Ribeiro
Thanks, Edzer. I used «breaks = seq (from = 0, to = 0.4, by = 0.01)» and
it works beautifully!
Best regards,
PauloFR

Às 14:10 de 19-02-2020, Edzer Pebesma escreveu:

> With the breaks argument you can specify the numbers at which colors break.
>
> On 2/19/20 3:05 PM, Paulo Flores Ribeiro wrote:
>> Hello,
>> I want to compare the spatial distribution of a variable in 7 different
>> scenarios by running the same plot code successively 7 times (within sf
>> package), each time changing the values of the variable for each
>> scenario. In each run, I copy-paste the map into a word document. In the
>> end, I want to visually compare the 7 maps, but for that I need the
>> scale range of the legend values to be the same on the seven maps
>> (including the colour ramp).
>> How to force the scale interval (and the corresponding colour ramp) to
>> be the same on the seven maps, within the sf package?
>> Thanks,
>> PauloFR
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: using the same legend for different scenarios in sf plots

Facundo Muñoz-2
In addition to Edzer's answer, I'd suggest considering producing a
single faceted plot with the 7 maps with a common legend, which might be
a more straightforward way to present a comparison of scenarios.

See, for instance, an example at
https://umr-astre.pages.mia.inra.fr/presentations/2019_rfsa_lsd/#21

ƒacu.-


On 19/02/2020 16:05, Paulo Flores Ribeiro wrote:

> Thanks, Edzer. I used «breaks = seq (from = 0, to = 0.4, by = 0.01)» and
> it works beautifully!
> Best regards,
> PauloFR
>
> Às 14:10 de 19-02-2020, Edzer Pebesma escreveu:
>> With the breaks argument you can specify the numbers at which colors break.
>>
>> On 2/19/20 3:05 PM, Paulo Flores Ribeiro wrote:
>>> Hello,
>>> I want to compare the spatial distribution of a variable in 7 different
>>> scenarios by running the same plot code successively 7 times (within sf
>>> package), each time changing the values of the variable for each
>>> scenario. In each run, I copy-paste the map into a word document. In the
>>> end, I want to visually compare the 7 maps, but for that I need the
>>> scale range of the legend values to be the same on the seven maps
>>> (including the colour ramp).
>>> How to force the scale interval (and the corresponding colour ramp) to
>>> be the same on the seven maps, within the sf package?
>>> Thanks,
>>> PauloFR
>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> [hidden email]
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: using the same legend for different scenarios in sf plots

Paulo Flores Ribeiro
Thank you, Facundo. Nice graphs, by the way.
Cheers,
PauloFR

Às 13:27 de 20-02-2020, Facundo Muñoz escreveu:

> In addition to Edzer's answer, I'd suggest considering producing a
> single faceted plot with the 7 maps with a common legend, which might be
> a more straightforward way to present a comparison of scenarios.
>
> See, for instance, an example at
> https://umr-astre.pages.mia.inra.fr/presentations/2019_rfsa_lsd/#21
>
> ƒacu.-
>
>
> On 19/02/2020 16:05, Paulo Flores Ribeiro wrote:
>> Thanks, Edzer. I used «breaks = seq (from = 0, to = 0.4, by = 0.01)» and
>> it works beautifully!
>> Best regards,
>> PauloFR
>>
>> Às 14:10 de 19-02-2020, Edzer Pebesma escreveu:
>>> With the breaks argument you can specify the numbers at which colors break.
>>>
>>> On 2/19/20 3:05 PM, Paulo Flores Ribeiro wrote:
>>>> Hello,
>>>> I want to compare the spatial distribution of a variable in 7 different
>>>> scenarios by running the same plot code successively 7 times (within sf
>>>> package), each time changing the values of the variable for each
>>>> scenario. In each run, I copy-paste the map into a word document. In the
>>>> end, I want to visually compare the 7 maps, but for that I need the
>>>> scale range of the legend values to be the same on the seven maps
>>>> (including the colour ramp).
>>>> How to force the scale interval (and the corresponding colour ramp) to
>>>> be the same on the seven maps, within the sf package?
>>>> Thanks,
>>>> PauloFR
>>>>
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> [hidden email]
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> [hidden email]
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo