classPlot: Plot bars for item counts grouped and colored by class

View source: R/class_plot.R

classPlotR Documentation

Plot bars for item counts grouped and colored by class

Description

This function plots bars for item counts grouped and colored by class.

Usage

classPlot(
  df,
  title = NULL,
  xLab = "Value",
  yLab = "Item",
  legendTitle = "Class",
  palette = "Spectral",
  labelSize = 2.5,
  labelColor = "black",
  legendTitleSize = 10,
  legendTextSize = 10,
  axisTextSize = 12,
  axisTitleSize = 12,
  decreasing = TRUE,
  valueCutoff = 0,
  ...
)

Arguments

df

A data frame with at least three columns. Its first column (categorical) colors the plot bars. The second column (categorical) labels the plots bars. The third column (numeric) sets the bar lengths.

title

Plot title.

xLab

x axis label.

yLab

y axis label.

legendTitle

Legend title.

palette

Color palette.

labelSize

Label size.

labelColor

Label color.

legendTitleSize

Legend title size.

legendTextSize

Legend text size.

axisTextSize

Axis text size.

axisTitleSize

Axis title size.

decreasing

Whether to display the bars in decreasing order of length.

valueCutoff

Cutoff used for filtering the input data frame based on the third (value) column. Only values above this cutoff will be displayed on the plot.

...

Additional arguments passed to centerTitle.

Value

An object of class gg.

Examples

 df <- data.frame(Class = sample(paste0('C', seq(13)), 25, replace=TRUE),
 Item = paste0('I', seq(25)),
 Value = runif(25, 0.5, 1))
 classPlot(df)

 df <- data.frame(Class = sample(paste0('C', seq(13)), 25, replace=TRUE),
 Item = sample(paste0('I', seq(21)), 25, replace=TRUE),
 Value = runif(25, 0.5, 1))
 classPlot(df)


henna documentation built on Feb. 17, 2026, 9:08 a.m.