plot.garrett: Plot Garrett Ranking Results

View source: R/garrett_rank.R

plot.garrettR Documentation

Plot Garrett Ranking Results

Description

Produces graphical representations of Garrett ranking results.

Usage

## S3 method for class 'garrett'
plot(
  x,
  type = c("bar", "lollipop", "dot", "line", "heatmap", "cluster", "contribution"),
  top = NULL,
  color = "#2C7FB8",
  label = TRUE,
  point_size = 3,
  line_size = 1,
  cluster_rows = TRUE,
  cluster_cols = FALSE,
  distance = "euclidean",
  clustering_method = "complete",
  scale = "none",
  show_numbers = FALSE,
  ...
)

Arguments

x

An object of class "garrett" created by garrett_rank.

type

Type of plot. Options are "bar", "lollipop", "dot", "line", "heatmap", "cluster", and "contribution".

top

Number of top-ranked factors to display. Default is NULL, which displays all factors. Applies to ranking plots.

color

Colour used for ranking plots.

label

Logical. Should Garrett scores be displayed as labels?

point_size

Size of points used in dot, lollipop, and line plots.

line_size

Width of lines used in lollipop and line plots.

cluster_rows

Logical. Should factors be hierarchically clustered in cluster plots?

cluster_cols

Logical. Should ranks be hierarchically clustered?

distance

Distance measure used for hierarchical clustering.

clustering_method

Method used for hierarchical clustering.

scale

Should heatmap data be scaled by rows, columns, or not scaled? Options are "none", "row", or "column".

show_numbers

Logical. Should matrix values be displayed inside heatmap cells?

...

Additional arguments passed to pheatmap::pheatmap.

Value

For "bar", "lollipop", "dot", and "line" plots, a ggplot object. For "heatmap", "cluster", and "contribution" plots, a pheatmap object returned invisibly. The returned object contains the graphical representation of the Garrett ranking results.

Examples


data(garrett_example)
result <- garrett_rank(garrett_example,respondent = "Respondent")
#Select the plot type
plot(result, type = "bar")
plot(result, type = "lollipop")
plot(result, type = "dot")
plot(result, type = "line")
plot(result, type = "heatmap")
plot(result, type = "cluster")
plot(result,type="contribution")
plot(result, type = "cluster", k = 3)
plot(result,type = "cluster",scale = "row",show_numbers = TRUE)


GarrettRank documentation built on Oct. 6, 2026, 5:07 p.m.