
plot_proportions
plot_proportions.Rd
Plot metadata proportions across groups with sample variable. Internal helper for
plotCellProportions
.
Usage
plot_proportions(
object,
var1,
var2,
type_setting,
pos = "stack",
filter.eval = NULL,
sort = F,
var_sample = "Region",
select_var1 = NULL,
select_var2 = NULL,
sample_props = TRUE
)
Arguments
- object
SpatialMap or Region object
- var1
Variable name from cellMetadata or projectMetadata. Defines groups on the x axis (
aes(x = var1)
to paraphraseggplot2
syntax).- var2
Variable name from cellMetadata or projectMetadata. Defines groups that will be indicated by different fill colors (
aes(fill = var2)
to paraphraseggplot2
syntax).- pos
(optional)
position
argument passed togeom_*
function. For example, if type=="bar" then pos is passed togeom_bar
asgeom_bar(..., position = pos)
.- filter.eval
A quoted character string that will be parsed and evaluated by
rlang::parse_expr
within a dplyrfilter
- var_sample
(optional) variable used to demarcate samples for strip charts, violin charts, or box charts(default="Region")
- select_var1
Used to select which items from var1 should be included in the graph. (default = NULL, meaning no items excluded from final chart).
- select_var2
Same as "select_var1", except for var2.
- sample_props
(optional) Whether to plot cell proportions within
var_sample
(default = TRUE). If TRUE and type=="bar", the mean cell proportions will be plotted. If FALSE, cell counts will be plotted instead.