This function generates a custom plot based on three categorical variables and a group variable. It adapts to the number of unique categories in z
and allows customization of various plot aesthetics.
dice_plot(
data,
x = NULL,
y = NULL,
z = NULL,
group = NULL,
group_alpha = 0.5,
title = NULL,
z_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_x = 0.5,
base_height_per_y = 0.3,
reverse_ordering = FALSE,
cluster_by_row = TRUE,
cluster_by_column = TRUE,
show_legend = TRUE,
cat_a = NULL,
cat_b = NULL,
cat_c = NULL,
cat_c_colors = NULL,
cat_b_order = NULL,
base_width_per_cat_a = NULL,
base_height_per_cat_b = NULL
)
A ggplot object representing the dice plot.
A data frame containing the categorical and group variables for plotting.
A string representing the column name in data
for the first categorical variable.
A string representing the column name in data
for the second categorical variable.
A string representing the column name in data
for the third categorical variable.
A string representing the column name in data
for the grouping variable.
A numeric value for the transparency level of the group rectangles. Default is 0.5
.
An optional string for the plot title. Defaults to NULL
.
A named vector of colors for z
categories or a string to chose a colorbrewer palette. Defaults to NULL
using the first suitable colorbrewer palette to use.
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.
A ggplot2 theme for customizing the plot's appearance. Defaults to theme_minimal()
.
Maximal dot size for the plot to scale the dot sizes.
Minimal dot size for the plot to scale the dot sizes.
Relative width of your legend. Default is 0.25.
Relative width of your legend. Default is 0.5.
Used for dynamically scaling the width. Default is 0.5.
Used for dynamically scaling the height. Default is 0.3.
Should the cluster ordering be reversed?. Default is FALSE.
Cluster rows, defaults to TRUE
Cluster columns, defaults to TRUE
Do you want to show the legend? Default is TRUE
Deprecated. Use x
instead.
Deprecated. Use y
instead.
Deprecated. Use z
instead.
Deprecated. Use z_colors
instead.
Deprecated. Use cluster_by_row
instead. Will be removed in a future version.
Deprecated. Use base_width_per_x
instead.
Deprecated. Use base_height_per_y
instead.