Skip to content

Instantly share code, notes, and snippets.

@deldersveld
Created July 21, 2016 19:20
Show Gist options
  • Save deldersveld/63d35843039a0c456b98494d13790d5a to your computer and use it in GitHub Desktop.
Save deldersveld/63d35843039a0c456b98494d13790d5a to your computer and use it in GitHub Desktop.
library(leaflet)
library(htmlwidgets)
library(webshot)
customPalette <- colorFactor(c("red", "red", "navy", "#00274c"), domain = dataset$OwnerType)
m <- leaflet(data = dataset) %>%
setView(-85.5, 42.3, zoom = 6) %>%
addProviderTiles("CartoDB.Positron") %>%
addCircleMarkers(~Longitude, ~Latitude, radius = ~ifelse(OwnerType == "Private", 1, 3), color = ~customPalette(OwnerType), stroke = FALSE, fillOpacity = 0.8)
saveWidget(m, "temp.html", selfcontained = FALSE)
webshot("temp.html", file = "temp.png", cliprect = "viewport")
@FELIPE-1412
Copy link

Hello colleague,
First of all, thanks for sharing your code. I am currently interested in making maps with the R leaflet library and rendering them in the Power BI environment. Unfortunately I have not been able to do it, I even thought it was not possible.

With the code you shared is it possible to perform this task? If so, could you share your data with me to replicate the results?

Thanks, I'll keep an eye out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment