Created
July 21, 2016 19:20
-
-
Save deldersveld/63d35843039a0c456b98494d13790d5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
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
Will only render in Power BI Desktop, and it requires PhantomJS for the webshot package. Easiest to install PhantomJS in this case using Node.JS with npm.