gg_pie: Pie with ggplot2

View source: R/gg_plots.R

gg_pieR Documentation

Pie with ggplot2

Description

Pie with ggplot2

Usage

gg_pie(
  data.tb,
  y.c = "",
  color.c = "",
  title.c = "",
  palette.vc = "Set1",
  label.c = c("none", "value", "percent")[1],
  geom_text.ls = list(lab.i = 7, legend_title.i = 16, legend_text.i = 14, title.i = 16),
  figure.c = c("interactive", "my_pie.pdf", "none")[1]
)

Arguments

data.tb

Tibble (or data frame) containing the information

y.c

Character: name of the column with the factor to be displayed; alternatively, name of the column with the counts (in this case set the name of the column with the names of the factor levels with the 'color.c' argument)

color.c

Character: optional name of the column with the names of the factor levels

title.c

Character: plot title

palette.vc

Character: either the name of an RColorBrewer palette (default: 'Set1'; 'Paired' can be useful for parallel plotting) or a vector manually defining the colors

label.c

Character: (relative) counts to be displayed on the pie; either 'none' (default), 'value' or 'percent'

geom_text.ls

List of sizes for lab.i (default 7), legend_title.i (16), legend_text.i (14), and title.i (16)

figure.c

Character: either 'interactive' for interactive display, 'my_pie.pdf' for figure saving (only the extension matters), or 'none' to prevent plotting

Value

invisible ggplot2 object

Examples

sacurine.eset <- phenomis::reading(system.file("extdata/W4M00001_Sacurine-statistics", package = "phenomis"))
sacurine_pda.df <- Biobase::pData(sacurine.eset)
sacurine_pda.df <- sacurine_pda.df[!grepl("QC", rownames(sacurine_pda.df)), ]
gg_pie(sacurine_pda.df, y.c = "gender", label.c = "value")

SciDoPhenIA/phenomis documentation built on June 9, 2022, 11:54 p.m.