2 July 2015
library(plotROC) roc.ci <- calculate_roc(ex.data$M1, ex.data$D, ci = TRUE, alpha = 0.05) ci.rocplot <- ggroc(roc.ci, label = "CI Example", ci = TRUE) cat( export_interactive_roc(ci.rocplot, prefix = "aci", omit.d3 = TRUE) ) plot_journal_roc(ci.rocplot)
Raw data
## mpg hp ## Mazda RX4 21 110
{x: .5, y: .5}
Modify rendered elements in browser
ggplot(mtcars, aes(mpg, hp)) + geom_point(size = 5) grid::grid.force() pts <- grid::grid.ls(print = FALSE)$name %>% grep("geom_point.points", ., value = TRUE) gridSVG::grid.garnish(pts, cyl = paste(mtcars$cyl), group = FALSE) gridSVG::grid.export(NULL, prefix = "mt1")$svg
Not a .png
! Generates svg code interpreted by the browser
d3.js
d3.js
concepts:
var points = d3.selectAll("[id^='mt1geom_point.points.279.1.']") points.on("click", function(){ // do something alert("cyl: " + d3.select(this).attr("cyl")); })
grid.garnish(key = value)
extract with
.attr("key")
R
(alpha = 0
),
show them interactively
.attr("opacity", 1)
panel.background.rect
useful for creating d3 scalesfig.keep='none', results = 'asis'
in knitr
R
then create SVG for use in browser
d3.js
to provide interactivity
R
packages to accomplish specific task, e.g. plotROC
, (plotKM
?)This would not be possible without the following: