make_density {chronicle}R Documentation

Create a density plot from a data frame through ggplotly

Description

Create a density plot from a data frame through ggplotly

Usage

make_density(
  dt,
  value,
  groups = NULL,
  faceted = TRUE,
  scales = "fixed",
  ggtheme = "minimal",
  x_axis_label = NULL,
  plot_palette = NULL,
  plot_palette_generator = "plasma",
  static = FALSE
)

Arguments

dt

data.frame containing the data to plot.

value

Name of the column to use as values on the y axis of the plot.

groups

Name of the column containing the different groups.

faceted

If TRUE (default), each group will be plotted separately.

scales

From ggplot2::facet_wrap: Should scales be 'fixed', 'free', or free in one dimension ('free_x', 'free_y'). Default is 'fixed'.

ggtheme

ggplot2 theme function to apply. Default is ggplot2::theme_minimal.

x_axis_label

Label for the x axis.

plot_palette

Character vector of hex codes specifying the colors to use on the plot.

plot_palette_generator

Palette from the viridis package used in case plot_palette is unspecified or insufficient for the number of colors required.

static

If TRUE (or if the dataset is over 10,000 rows), the output will be static ggplot chart instead of an interactive ggplotly chart. Default is FALSE.

Value

A plotly-ized version of a ggplot density plot.

Examples

make_density(dt = iris,
             value = 'Sepal.Length',
             groups = 'Species')
make_density(dt = iris,
             value = 'Sepal.Length',
             groups = 'Species',
             faceted = FALSE)

[Package chronicle version 0.3 Index]