diff --git a/DESCRIPTION b/DESCRIPTION index 58f2f20..ff40c96 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,6 +28,7 @@ Suggests: knitr, rmarkdown, ggthemes, + plotly Imports: graphics, grDevices, @@ -48,6 +49,7 @@ Collate: 'a-pokemon-colors.r' 'coord_proj.r' 'formatters.r' + 'geom2plotly.r' 'geom_ash.r' 'geom_bkde.r' 'geom_bkde2d.r' diff --git a/NAMESPACE b/NAMESPACE index 0930866..bd3b305 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -38,6 +38,9 @@ export(stat_ash) export(stat_bkde) export(stat_bkde2d) export(stat_xspline) +export(to_basic.GeomBkde2d) +export(to_basic.GeomStateface) +export(to_basic.GeomXspline) import(KernSmooth) import(MASS) import(ash) diff --git a/R/geom2plotly.r b/R/geom2plotly.r new file mode 100644 index 0000000..ce33182 --- /dev/null +++ b/R/geom2plotly.r @@ -0,0 +1,16 @@ +#' @export +to_basic.GeomXspline <- to_basic.GeomXspline2 <- + getFromNamespace("to_basic.GeomLine", asNamespace("plotly")) + +#' @export +to_basic.GeomBkde2d <- + getFromNamespace("to_basic.GeomDensity2d", asNamespace("plotly")) + +#' @export +to_basic.GeomStateface <- function(data, prestats_data, layout, params, p, ...) { + prefix_class(data, "GeomText") +} + +prefix_class <- function(x, y) { + structure(x, class = unique(c(y, class(x)))) +} diff --git a/R/stateface.r b/R/stateface.r index cf206ea..25661a4 100644 --- a/R/stateface.r +++ b/R/stateface.r @@ -22,7 +22,7 @@ show_stateface <- function() { path <- normalizePath(file.path(system.file("fonts/", package="ggalt"))) print(path) - if (!interactive) return() + if (!interactive()) return() if (.Platform$OS.type == "windows") { shell(sprintf("explorer %s", path), intern=TRUE)