3

I try to make a simple choropleth map using tmap :

library(tmap)

data(World, rivers, metro)
qtm(World, fill="HPI", fill.n=9, fill.palette="div", fill.auto.palette.mapping=FALSE, 
 fill.title="Happy Planet Index", fill.id="name", format="World", style="gray")

I would like to update the legend: instead of "20 to 25", I would like to get "20-25" or "20 à 25".

I haven't found the parameter that would let me choose this.

zx8754
  • 52,746
  • 12
  • 114
  • 209
Malta
  • 1,883
  • 3
  • 17
  • 30

1 Answers1

3

We need to use text.separator in tm_layout, see below:

qtm(World, fill="HPI", fill.n=9, fill.palette="div", fill.auto.palette.mapping=FALSE, 
    fill.title="Happy Planet Index", fill.id="name", format="World", style="gray",
    text.separator="-") +
  tm_layout(legend.format = list(text.separator = "-"))
zx8754
  • 52,746
  • 12
  • 114
  • 209