Created
November 18, 2015 22:14
-
-
Save saptarshiguha/1bddbb8e967d88dae5af 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
| ## In https://github.com/rstudio/htmltools/blob/master/R/html_print.R#L41 | |
| ## html_print doesn't have an option on how and where to write the html | |
| ## it always creates anothe temporary directory and writes the HTML there | |
| ## This bypasses that with an uglry recursive copy ... | |
| options(rbokehViewDir = tempfile("rbokehviz")) | |
| if(!file.exists(getOption("rbokehViewDir"))) | |
| dir.create(getOption("rbokehViewDir")) | |
| options(viewer = (function(){ | |
| first <- TRUE | |
| function(u,height){ | |
| rbokehdir <- getOption("rbokehViewDir") | |
| for(k in list.files(dirname(u),full=TRUE)){ | |
| file.copy(k, rbokehdir, overwrite=TRUE,recursive=TRUE) | |
| } | |
| index_html <- file.path(rbokehdir, "index.html") | |
| message(sprintf("Viewing figure at %s", index_html) | |
| if(first){ | |
| utils::browseURL(index_html) | |
| first <<- FALSE | |
| } | |
| } | |
| })()) | |
| library(rbokeh) | |
| p <- figure(logo='None',tool=NULL) | |
| p <- ly_points(p,Sepal.Length, Sepal.Width, data = iris, | |
| color = Species, glyph = Species, | |
| hover = list(Sepal.Length, Sepal.Width)) | |
| p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment