Learn R Programming

henna (version 0.3.4)

classPlot: Plot item bars grouped by class

Description

This function plots bars for each item while grouping them by class and ordering them.

Usage

classPlot(
  df,
  title = "Class plot",
  xLab = "Value",
  yLab = "Item",
  legendLab = "Class",
  palette = "Spectral",
  labelSize = 2.5,
  labelColor = "black",
  decreasing = TRUE,
  valueCutoff = 0,
  ...
)

Value

An object of class gg.

Arguments

df

A data frame with at least three columns, with class, item and value as the first three columns. The latter must be numeric.

title

Plot title.

xLab

Label of x axis.

yLab

Label of y axis.

legendLab

Legend label.

palette

grDevices palette used for coloring nodes. Ignored if nodeColor is not NULL.

labelSize

Label size. Ignored if labelDF is NULL.

labelColor

Label color.

decreasing

Whether to display the bars in decreasing order of length.

valueCutoff

Cutoff used for filtering the input data frame based on the value column. Only values greater than this cutoff will be displayed on the plot.

...

Other 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