Produces stacked bar plots using base graphics or ggplot2 showing amounts of cell subclasses in deconvoluted bulk samples.
stack_plot(
x,
percent = FALSE,
order_col = 1,
scheme = NULL,
order_cells = c("none", "increase", "decrease"),
seriate = NULL,
cex.names = 0.7,
show_xticks = TRUE,
...
)stack_ggplot(
x,
percent = FALSE,
order_col = 1,
scheme = NULL,
order_cells = c("none", "increase", "decrease"),
seriate = NULL,
legend_ncol = NULL,
legend_position = "bottom",
show_xticks = FALSE
)
The base graphics function has no return value. It plots a stacked barchart using base graphics. The ggplot2 version returns a ggplot2 object.
matrix of deconvolution results with samples in rows and cell subclasses or groups in columns. If a 'deconv' class object is supplied the deconvolution values for the cell subclasses are extracted and plotted.
Logical whether to scale the matrix rows as percentage.
Numeric value for which column (cell subclass) to use to
sort the bars - this only applies if percent = TRUE. If a vector of
column indices is supplied, these columns are averaged first using
rowMeans(). If percent = FALSE, then the default is to sort bars from
low to high based on the row sums (i.e. total subclass cell amounts in each
sample). Setting order_col = 0 disables sorting of bars; in this case
bars are shown in the original order of the rows of x.
Vector of colours. If not supplied, the default scheme uses
scales::hue_pal().
Character value specifying with cell types are ordered by abundance.
Character value which enables ordering of samples using the
seriation package. Any matrix based seriation methods can be used to
order the samples. Recommended options include "CA", "BEA" or "BEA_TSP".
Character expansion controlling bar names font size.
Logical whether to show rownames as x axis labels.
Optional arguments passed to graphics::barplot().
Number of columns for ggplot2 legend. If set to NULL
ggplot2 sets the column number automatically.
Position of ggplot2 legend