Plots a mosaic plot of two grouping variables.

plotMosaicplot(object, grouping, fill_by, clrp = NULL, clrp_adjust = NULL, ...)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

grouping

Character value. The grouping variable that is plotted on the x-axis.

fill_by

Character value. The grouping variable that is used to fill the mosaic.

clrp

Character value. Specifies the color palette to be used to represent groups of discrete variables. Run validColorPalettes() to obtain valid input options.

clrp_adjust

Named character vector or NULL. If character, it adjusts the color palette that is used to represent the groups. Names of the input vector must refer to the group and the respective named element denotes the color with which to represent the group.

...

Additional arguments given to ggmosaic::geom_mosaic()

Value

Returns a ggplot that can be additionally customized according to the rules of the ggplot2 framework.

Examples

library(SPATA2)

data("example_data")

object <- example_data$object_UKF275T_diet

plotMosaicPlot(object, grouping = "seurat_clusters", fill_by = "bayes_space")