Learn R Programming

henna (version 0.3.4)

rankPlot: Create a rank plot

Description

This function creates a rank plot.

Usage

rankPlot(
  df,
  title = "Rank plot",
  summarize = TRUE,
  viridisPal = "turbo",
  xLab = "Item",
  yLab = "Rank count",
  legendLab = "Rank",
  sigDigits = NULL,
  labelSize = 2.5,
  labelColor = "black",
  labelFace = c("plain", "bold", "italic", "bold-italic"),
  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

Label of y axis.

legendLab

Legend label.

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.

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.

...

Other 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