plot_feat_subtype: Plot multiple features of subtypes

Description Usage Arguments

View source: R/plot_feat_subtype.R View source: R/FIXME/tmp.R

Description

Plot percentage barplot or violin/boxplot for discrete or continuous variables of each subtype. Return a list of ggplots that can be arranged into figure panel with ggarrange.
Usage: plist <- plot_feat_subtype(df,"Stage",c("Ploidy","Purity","EGFR","Smoker"))
then p <- ggpubr::ggarrange(plotlist=plist,align="hv")
ggsave("file.pdf",p)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
plot_feat_subtype(
  plotdf,
  subtype,
  feat.plot,
  cont.plot = "boxplot",
  cont.test = "wilcox.test",
  disc.test = "both",
  p.label = NULL,
  p.symnum.args = list(),
  cont.show.mean = FALSE,
  show.count = TRUE,
  cont.col = comp_hm_colist_full$disc,
  disc.col = comp_hm_colist_full,
  disc.width = 0.8,
  cont.width = 0.9,
  disc.border = TRUE,
  cont.border = TRUE,
  anno.textsize = 4,
  cont.anno.vjust = 0.2,
  disc.anno.vjust = 0.04,
  aspect.ratio = 1.4,
  legend.position = "bottom",
  highlight.signif = TRUE,
  highlight.signif.col = "red",
  signif.cutoff = 0.05,
  plot.signif.only = F,
  ...
)

Arguments

plotdf

dataframe with rows of samples and columns of features, one column should contain the subtype info.

subtype

column name of the subtype

feat.plot

character vector of the features to be plotted

cont.plot

character of either "boxplot" or "violin"

cont.test

the significance test to be used for continuous variables. Use the name of the r basic tests.

disc.test

the significance test to be used for discrete variables. Should be "fisher","chi" or"both"

p.label, p.symnum.args

change the label style ("p.signif" or "p.format") of the significance. See stat_compare_means

cont.show.mean

boolean of whether to show the mean as a green dot for continuous variables

show.count

whether to show the total count of each catergory

cont.col

vector of colors for continuous variables

disc.col

list of named vectors for colors of discrete variables

disc.border, cont.border

show border or not for the discrete/continuous variables. pass to perc_barplot,violin

anno.textsize

change text size of the significance values

cont.anno.vjust, disc.anno.vjust

numeric to tweak the position of the pvalue annotation on the plot

aspect.ratio

the height width ratio of the figure

legend.position

position of the legends

highlight.signif, highlight.signif.col, signif.cutoff

Whether to highlight (highlight.signif) a significant plot with a color border (highlight.signif.col) according to the p-value cutoff (signif.cutoff). See miscPlots

plot.signif.only

whether to plot only the significant items

...

pass to theme for each individual plot


brightchan/cjbmisc documentation built on Nov. 5, 2021, 4:12 p.m.