percent_bar_plot: Function to create a percent bar plot.

View source: R/percent_bar.R

percent_bar_plotR Documentation

Function to create a percent bar plot.

Description

Function to create a percent bar plot.

Usage

percent_bar_plot(
  input,
  x,
  y,
  subset.x = NULL,
  color = NULL,
  palette = NULL,
  title = NULL,
  axis_angle = 0,
  coord_flip = FALSE,
  add_Freq = TRUE,
  Freq = NULL,
  size_freq = 8,
  legend.size = 0.5,
  legend.size.text = 10,
  add_sum = T,
  print_result = T,
  round.num = 2
)

Arguments

input

Input data frame.

x

Name of the x-axis variable.

y

Name of the y-axis variable.

subset.x

Optional subset of x-axis values.

color

Optional color palette for the bars.

palette

Optional palette type for color selection.

title

Optional title for the plot.

axis_angle

Optional angle for the axis labels. range from [0,90]

coord_flip

Boolean indicating whether to flip the x and y axes.

add_Freq

default is true for data frame

Freq

Optional name for the frequency column.

size_freq

Size of the frequency labels.

legend.size

Size of the legend.

legend.size.text

Size of the legend text.

add_sum

Boolean indicating whether to add the sum to the x-axis labels.

print_result

Boolean indicating whether to print the result data frame.

round.num

Number of decimal places to round the proportion column.

Author(s)

Dongqiang Zeng

Examples

data("sig_stad", package = 'IOBR')
table(sig_stad$Subtype, sig_stad$Lauren)
percent_bar_plot(input = sig_stad, x = "Subtype", y = "Lauren", axis_angle = 60)

IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.