Learn R Programming

henna (version 0.7.5)

classPlot: 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,
  ...
)

Value

An object of class gg.

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.

Examples

Run this code
 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)

Run the code above in your browser using DataLab