0

I am trying to create a leaflet map in R studio but the map appears to have blue background. Although it is showing the markers but not the actual map. Initially I thought it is due to slow processing in my system. But I tried on another system as well and got the same result.

Here is my Code,

library(leaflet)

m <- leaflet(vert) %>% addTiles() %>% 
  addMarkers(data = vert, popup = ~location_label(name)) %>%
  addPolylines(data = edges, weight = links$Weight, popup = edge_label(links$Weight)) %>% 
  addProviderTiles(providers$OpenStreetMap) 

m

Can anybody please suggest what mistake I am doing. I have all the arguments of the map in place but it still showing blue background.

This is the image of map I am getting.

Phil
  • 7,287
  • 3
  • 36
  • 66

1 Answers1

0

I am sorry, my mistake. I just realised the problem. The problem - The weight of Polylines was ranging from 5 to 1000. Due to this, the entire map was appearing in blue color. When I divided the weight by 50, it started appearing correctly.

Here is the updated code,

library(leaflet)

m <- leaflet(vert) %>% addTiles() %>% 
  addMarkers(data = vert, popup = ~location_label(name)) %>%
  addPolylines(data = edges, weight = links$Weight/50, popup = edge_label(links$Weight)) %>% 
  addProviderTiles(providers$OpenStreetMap) 

m

This is the resultant map