plot_density_class: Plot density per class

View source: R/graphics.R

plot_density_classR Documentation

Plot density per class

Description

This function generates density plots using ggplot2 grouped by a specified class label from a data frame containing numeric values.

Usage

plot_density_class(
  data,
  class_label,
  label_x = "",
  label_y = "",
  colors = NULL,
  bin = NULL,
  alpha = 0.5
)

Arguments

data

data.frame contain x, value, and variable

class_label

name of attribute for class label

label_x

x-axis label

label_y

y-axis label

colors

color vector

bin

bin width for density estimation

alpha

level of transparency

Value

returns a ggplot graphic

Examples

grf <- plot_density_class(iris |> dplyr::select(Sepal.Width, Species),
 class = "Species", colors=c("red", "green", "blue"))
plot(grf)

daltoolbox documentation built on Nov. 3, 2024, 9:06 a.m.