R/geom_freqpoly_interactive.R, R/geom_histogram_interactive.R
geom_histogram_interactive.RdThe geometries are based on ggplot2::geom_histogram()
and ggplot2::geom_freqpoly().
See the documentation for those functions for more details.
This interactive version is only providing a single tooltip per
group of data (same for data_id). It means it is only possible
to associate a single tooltip to a set of bins.
geom_freqpoly_interactive(...)
geom_histogram_interactive(...)arguments passed to base function, plus any of the interactive_parameters.
The interactive parameters can be supplied with two ways:
As aesthetics with the mapping argument (via ggplot2::aes()).
In this way they can be mapped to data columns and apply to a set of geometries.
As plain arguments into the geom_*_interactive function. In this way they can be set to a scalar value.
# add interactive histogram -------
library(ggplot2)
library(ggiraph)
p <- ggplot(diamonds, aes(carat)) +
geom_histogram_interactive(bins=30, aes(tooltip = after_stat(count),
group = 1L) )
x <- girafe(ggobj = p)
#> Error in (function (mapping = NULL, data = NULL, stat = "bin", position = "stack", ..., binwidth = NULL, bins = NULL, orientation = NA, lineend = "butt", linejoin = "mitre", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) { layer(mapping = mapping, data = data, geom = "bar", stat = stat, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list2(na.rm = na.rm, binwidth = binwidth, bins = bins, orientation = orientation, lineend = lineend, linejoin = linejoin, ...))})(bins = 30, structure(list(group = 1L), class = c("ggplot2::mapping", "uneval", "gg", "S7_object"), S7_class = structure(function (x = list(), ..., env = globalenv()) { warn_dots_empty() check_object(x, is.list, "a {.cls list}") x <- lapply(x, new_aesthetic, env = env) x <- S7::new_object(x) class(x) <- union(c("ggplot2::mapping", "uneval"), class(x)) x}, name = "mapping", parent = structure(list(class = "gg", constructor = function (.data) { stop(sprintf("S3 class <%s> doesn't have a constructor", class[[1]]), call. = FALSE)}, validator = NULL), class = "S7_S3_class"), package = "ggplot2", properties = list(), abstract = FALSE, constructor = function (x = list(), ..., env = globalenv()) { warn_dots_empty() check_object(x, is.list, "a {.cls list}") x <- lapply(x, new_aesthetic, env = env) x <- S7::new_object(x) class(x) <- union(c("ggplot2::mapping", "uneval"), class(x)) x}, class = c("S7_class", "S7_object")))): Problem while converting geom to grob.
#> ℹ Error occurred in the 1st layer.
#> Caused by error in `draw_panel()`:
#> ! unused arguments (lineend = "butt", linejoin = "mitre")
if( interactive() ) print(x)
p <- ggplot(diamonds, aes(price, colour = cut, tooltip = cut, data_id = cut)) +
geom_freqpoly_interactive(binwidth = 500)
x <- girafe(ggobj = p)
x <- girafe_options(x = x,
opts_hover(css = "stroke-width:3px;") )
if( interactive() ) print(x)