forked from apache/zeppelin
-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I tried charting with Leaflet.js in rCharts and with RStudio leaflet library, with no success with either.
Would you be so kind to post an example that works?
Also, have you tried Zeppelin with any htmlwidgets? Do they work?
(the method used below, of saving a file and displaying it as iframe was originally proposed by RamnathV as stop gap for jupyter with R kernel - it doesn't work with all htmlwidgets though).
Leaflet
The following works with the jupyter notebook and R kernel, but it does not work with Zeppelin R:
library(leaflet)
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
# Print the map
tf = 'myfigure.html'
htmlwidgets::saveWidget(m, file = tf, selfcontained = F)
IRdisplay::display_html(paste("<iframe src=' ", tf, " ' ","/>"))
rCharts
I tried to display the classic example below, but the chart is displayed on another tab as index.html (on Safari).
%spark.r
#
library(rCharts)
map3 <- Leaflet$new()
map3$setView(c(51.505, -0.09), zoom = 13)
map3$marker(c(51.5, -0.09), bindPopup = "<p> Hi. I am a popup </p>")
map3$marker(c(51.495, -0.083), bindPopup = "<p> Hi. I am another popup </p>")
map3
Metadata
Metadata
Assignees
Labels
No labels