A denstogram is a density plot, with some more info (the ecdf) to be displayed as a tooltip and the breaks of the axis showing quantiles.
denstogram(
data,
xvar,
fillvar = NULL,
facets_rows = NULL,
facets_cols = NULL,
facets_grid_wrap = c("grid", "wrap"),
facets_scales = "fixed",
facets_ncol = NULL,
facets_nrow = NULL,
trans = scales::identity_trans(),
probs = c(0, 0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99, 1),
na.rm = TRUE,
summary_geom = c("none", "line", "text", "both"),
summary_fn = function(x) stats::median(x, na.rm = na.rm),
yaxis_title = "Density",
xaxis_title = "",
plotly = TRUE
)
data to plot
var to plot
variable to fill denstogram by
variable to facet the denstogram by
variable to facet the denstogram by
whether to use a "grid" or "wrap" in facetting
passed to facets
cols for facets
rows for facets
transformation to apply from the scales
package
quantiles to include in the plot
logical; if TRUE
, missing values are removed
from x
. If FALSE
any missing values cause an error.
which geom to add to the plot, to display a summary indicator calculated by summary_fn
function to calculate a summary indicator. Must receive one numeric vector and return a numeric vector of length 1
character vector length 1
character vector length 1
whether to convert it to an interactive plot using plotly
ggplot object
denstogram(data = ggplot2::diamonds, xvar = price)
denstogram(data = ggplot2::diamonds, xvar = price, fillvar = color)
denstogram(data = ggplot2::diamonds, xvar = price, fillvar = cut)
denstogram(data = ggplot2::diamonds, xvar = price, facets_rows = cut)
denstogram(data = ggplot2::diamonds, xvar = price, facets_rows = cut,
facets_grid_wrap = "wrap")
denstogram(data = ggplot2::diamonds, xvar = price,
facets_rows = cut, facets_cols = color)
denstogram(data = ggplot2::diamonds, xvar = price,
facets_rows = cut, facets_cols = color, facets_grid_wrap = "wrap")
denstogram(data = ggplot2::diamonds, xvar = price, fillvar = cut,
facets_row = color)