1

I am using tmap_leaflet function to make a map and I like the result, however, I would like to slightly change the transparency of the shapefile such that I am able to see a bit of the tiles google street map underneath.

This is the code I used: I tried adding fillOpacity=0.5 to the tm_fill section,but it made no difference:

COmap <- tm_shape(map)+
   tm_fill(col="percent.content",
           breaks = c(0,2,5,10,25,Inf),
         labels = c(">0","2-5","5-10","10-25","25 or more"),
           textNA = "Not enough information",
           colorNA = "grey",
           title = "% reports labelled as content ",
           palette = MyColors)+
   tm_shape(districtsg)+
   tm_borders(col = "white")

# Map 1
COmap %>%  tmap_leaflet() %>%
   setView(lng = -1.0232,lat=7.9465,zoom = 6) %>% #lat and long of my district
   addProviderTiles('Esri.WorldGrayCanvas', group='Grayscale Map') %>% 
   addProviderTiles('OpenStreetMap', group='Street Map') 

I'd appreciate on your input which code to use to achieve what I want and where to place the appropriate code. Thanks in advance.

Ani
  • 328
  • 1
  • 4
  • 13

0 Answers0