This function generates a plot to visualize categorical data in a domino plot format. The size of the dots is fixed, and the plot can be saved to an output file if specified. This version supports categorical colors and allows setting colors for left and right rectangle plots.
dice_facet_plot(
data,
gene_list,
x = "gene",
y = "Celltype",
contrast = "Contrast",
var_id = "var",
spacing_factor = 3,
categorical_colors = NULL,
color_scale_name = "Category",
left_rect_color = "lightblue",
right_rect_color = "lightpink",
rect_alpha = 0.5,
axis_text_size = 8,
x_axis_text_size = NULL,
y_axis_text_size = NULL,
legend_text_size = 8,
cluster_method = "complete",
cluster_y_axis = TRUE,
cluster_var_id = TRUE,
base_width = 5,
base_height = 4,
show_legend = TRUE,
legend_width = 0.25,
legend_height = 0.5,
custom_legend = TRUE,
aspect_ratio = NULL,
switch_axis = FALSE,
reverse_y_ordering = FALSE,
show_var_positions = FALSE,
output_file = NULL,
feature_col = NULL,
celltype_col = NULL,
contrast_col = NULL
)
A list containing the domino plot and optionally the variable positions plot.
A data frame containing the categorical data.
A character vector of gene names to include in the plot.
A string representing the column name in data
for the feature variable (e.g., genes). Default is "gene"
.
A string representing the column name in data
for the cell type variable. Default is "Celltype"
.
A string representing the column name in data
for the contrast variable. Default is "Contrast"
.
A string representing the column name in data
for the variable identifier. Default is "var"
.
A numeric value indicating the spacing between gene pairs. Default is 3
.
A named vector of colors to use for categorical values in the data. Default is NULL.
A string specifying the name of the color scale in the legend. Default is "Category"
.
A string specifying the color for the left rectangles. Default is "lightblue"
.
A string specifying the color for the right rectangles. Default is "lightpink"
.
A numeric value between 0 and 1 indicating the transparency of the rectangles. Default is 0.5
.
A numeric value specifying the size of the axis text. Default is 8
.
A numeric value specifying the size of the x-axis text. If NULL, uses axis_text_size
. Default is NULL
.
A numeric value specifying the size of the y-axis text. If NULL, uses axis_text_size
. Default is NULL
.
A numeric value specifying the size of the legend text. Default is 8
.
The clustering method to use. Default is "complete"
.
A logical value indicating whether to cluster the y-axis (cell types). Default is TRUE
.
A logical value indicating whether to cluster the var_id. Default is TRUE
.
A numeric value specifying the base width for saving the plot. Default is 5
.
A numeric value specifying the base height for saving the plot. Default is 4
.
A logical value indicating whether to show the legend. Default is TRUE
.
A numeric value specifying the relative width of the legend. Default is 0.25
.
A numeric value specifying the relative height of the legend. Default is 0.5
.
A logical value indicating whether to use a custom legend. Default is TRUE
.
A numeric value specifying the aspect ratio of the plot. If NULL
, it's calculated automatically. Default is NULL
.
A logical value indicating whether to switch the x and y axes. Default is FALSE
.
A logical value indicating whether to reverse the y-axis ordering after clustering. Default is FALSE
.
A logical value indicating whether to show the intermediate variable positions plot. Default is FALSE
.
When output_file
is specified with a PDF extension, both plots will be saved to a multi-page PDF if this is TRUE
.
A warning will be shown if show_var_positions
is TRUE
but the output file is not a PDF.
An optional string specifying the path to save the plot. If NULL
, the plot is not saved. Default is NULL
.
Deprecated. Use x
instead.
Deprecated. Use y
instead.
Deprecated. Use contrast
instead.