Learn R Programming

henna (version 0.7.5)

rankPlot: Create a rank plot

Description

This function creates a rank plot.

Usage

rankPlot(
  df,
  title = NULL,
  summarize = TRUE,
  viridisPal = "turbo",
  xLab = "Item",
  yLab = "Rank count",
  legendTitle = "Rank",
  sigDigits = NULL,
  labelSize = 2.5,
  labelColor = "black",
  labelFace = c("plain", "bold", "italic", "bold-italic"),
  legendTextSize = 10,
  legendTitleSize = 10,
  axisTextSize = 12,
  axisTitleSize = 12,
  xAngle = 45,
  vJust = 0.6,
  labelScalingFactor = 0.9,
  labelOffset = 0.05,
  ...
)

Value

An object of class gg.

Arguments

df

A data frame with ranks as columns and items as rows, or a summary data frame generated with rankSummary. If the latter, summarize must be set to FALSE.

title

Plot title.

summarize

Whether to summarize the ranks with rankSummary. Must be set to FALSE if the input data frame has been generated with rankSummary.

viridisPal

Viridis palette.

xLab

Label of x axis.

yLab

y axis label.

legendTitle

Legend title.

sigDigits

Number of significant digits used when displaying mean ranks. If NULL, the mean ranks will not be displayed.

labelSize

Size of label marking average rank for each item. Ignored if sigDigits is NULL.

labelColor

Color of label marking average rank for each item. Ignored if sigDigits is NULL.

labelFace

Font face of label marking average rank for each item. Must be one among 'plain', 'bold', 'italic' and 'bold-italic'. Ignored if sigDigits is NULL.

legendTextSize

Legend text size.

legendTitleSize

Legend title size.

axisTextSize

Axis text size.

axisTitleSize

Axis title size.

xAngle

Angle of x axis text.

vJust

Vertical justification in [0, 1].

labelScalingFactor

Scaling factor used when displaying mean ranks. Ignored if sigDigits is NULL.

labelOffset

Vertical offset used when displaying mean ranks. Ignored if sigDigits is NULL.

...

Additional arguments passed to centerTitle.

Examples

Run this code
df <- do.call(cbind, lapply(seq(30), function(i) sample(10, 10)))
rownames(df) <- paste0('M', seq(10))
colnames(df) <- paste0('R', seq(30))
rankPlot(df)

Run the code above in your browser using DataLab