dice_plot {diceplot}R Documentation

Dice Plot Visualization

Description

This function generates a custom plot based on three categorical variables and a group variable. It adapts to the number of unique categories in cat_c and allows customization of various plot aesthetics.

Usage

dice_plot(
  data,
  cat_a,
  cat_b,
  cat_c,
  group = NULL,
  group_alpha = 0.5,
  title = NULL,
  cat_c_colors = NULL,
  group_colors = NULL,
  custom_theme = theme_minimal(),
  max_dot_size = 5,
  min_dot_size = 2,
  legend_width = 0.25,
  legend_height = 0.5,
  base_width_per_cat_a = 0.5,
  base_height_per_cat_b = 0.3,
  reverse_ordering = FALSE,
  cat_b_order = NULL,
  cluster_by_row = TRUE,
  cluster_by_column = TRUE,
  show_legend = TRUE
)

Arguments

data

A data frame containing the categorical and group variables for plotting.

cat_a

A string representing the column name in data for the first categorical variable.

cat_b

A string representing the column name in data for the second categorical variable.

cat_c

A string representing the column name in data for the third categorical variable.

group

A string representing the column name in data for the grouping variable.

group_alpha

A numeric value for the transparency level of the group rectangles. Default is 0.5.

title

An optional string for the plot title. Defaults to NULL.

cat_c_colors

A named vector of colors for cat_c categories or a string to chose a colorbrewer palette. Defaults to NULL using the first suitable colorbrewer palette to use.

group_colors

A named vector of colors for the group variableor a string to chose a colorbrewer palette. Defaults to NULL using the first suitable colorbrewer palette to use.

custom_theme

A ggplot2 theme for customizing the plot's appearance. Defaults to theme_minimal().

max_dot_size

Maximal dot size for the plot to scale the dot sizes.

min_dot_size

Minimal dot size for the plot to scale the dot sizes.

legend_width

Relative width of your legend. Default is 0.25.

legend_height

Relative width of your legend. Default is 0.5.

base_width_per_cat_a

Used for dynamically scaling the width. Default is 0.5.

base_height_per_cat_b

Used for dynamically scaling the height. Default is 0.3.

reverse_ordering

Should the cluster ordering be reversed?. Default is FALSE.

cat_b_order

Do you want to pass an explicit order?. Default is NULL.

cluster_by_row

Cluster rows, defaults to TRUE

cluster_by_column

Cluster columns, defaults to TRUE

show_legend

Do you want to show the legend? Default is TRUE

Value

A ggplot object representing the dice plot.


[Package diceplot version 0.1.4 Index]