Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Imports:
stats
Suggests: network
LinkingTo: Rcpp
RoxygenNote: 6.0.0.9000
RoxygenNote: 6.0.1
Depends:
R (>= 2.10),
ggplot2 (>= 2.0.0)
Expand Down Expand Up @@ -63,6 +63,7 @@ Collate:
'layout_dendrogram.R'
'layout_igraph.R'
'layout_sec.R'
'plotly.R'
'scale_edge_alpha.R'
'scale_edge_colour.R'
'scale_edge_fill.R'
Expand Down
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ export(scale_edge_width_continuous)
export(scale_edge_width_discrete)
export(scale_edge_width_identity)
export(scale_edge_width_manual)
export(to_basic.GeomEdgeBezier)
export(to_basic.GeomEdgeBspline)
export(to_basic.GeomEdgeDensity)
export(to_basic.GeomEdgePath)
export(to_basic.GeomEdgeSegment)
export(to_basic.GeomTreemap)
export(treeApply)
import(ggplot2)
importFrom(MASS,bandwidth.nrd)
Expand Down
58 changes: 58 additions & 0 deletions R/plotly.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ---------------------------------------------------------------------------
# Translations for R/geom_axis_hive.R
# ---------------------------------------------------------------------------

# TODO: waiting for an example

# ---------------------------------------------------------------------------
# Translations for R/geom_edge.R
# ---------------------------------------------------------------------------

toPath <- function(data, prestats_data, layout, params, p, ...) {
prefix_class(data, "GeomPath")
}

#' @export
to_basic.GeomEdgePath <- toPath

#' @export
to_basic.GeomEdgeSegment <- toPath

#' @export
to_basic.GeomEdgeBezier <- toPath

#' @export
to_basic.GeomEdgeBspline <- toPath

# ---------------------------------------------------------------------------
# Translations for R/geom_edge_density.R
# ---------------------------------------------------------------------------

#' @export
to_basic.GeomEdgeDensity <- function(data, prestats_data, layout, params, p, ...) {
# avoid a weird precision issue
data$density[data$density < 0.005] <- 0
data$fill_plotlyDomain <- data$density
data$fill <- toRGB(
data$edge_fill, scales::rescale(data$density)
)
prefix_class(data, "GeomTile")
}

# ---------------------------------------------------------------------------
# Translations for R/geom_treemap.R
# ---------------------------------------------------------------------------

#' @export
to_basic.GeomTreemap <- getFromNamespace("to_basic.GeomRect", asNamespace("plotly"))


# ---------------------------------------------------------------------------
# Helper functions
# ---------------------------------------------------------------------------

prefix_class <- function(x, y) {
structure(x, class = unique(c(y, class(x))))
}