qbarplot: qbarplot

View source: R/ggExpress.R

qbarplotR Documentation

qbarplot

Description

Draw and save a barplot.

Usage

qbarplot(
  vec,
  also.pdf = FALSE,
  save.obj = FALSE,
  ext = MarkdownHelpers::ww.set.file.extension(default = "png", also_pdf = also.pdf),
  plot = TRUE,
  plotname = FixPlotName(substitute(vec)),
  subtitle = paste("Median:", iround(median(vec))),
  suffix = NULL,
  caption = suffix,
  filename = NULL,
  save = TRUE,
  mdlink = MarkdownHelpers::unless.specified("b.mdlink", def = FALSE),
  hline = FALSE,
  filtercol = 1,
  palette_use = c("RdBu", "Dark2", "Set2", "jco", "npg", "aaas", "lancet", "ucscgb",
    "uchicago")[4],
  col = as.character(1:3)[1],
  xlab = "",
  xlab.angle = 45,
  logY = FALSE,
  ylim = c(0, 1.1 * as.numeric(max(vec, na.rm = TRUE))),
  annotation_logticks_Y = logY,
  label = NULL,
  hide.legend = TRUE,
  legend.title = NULL,
  max.names = 100,
  limitsize = FALSE,
  grid = "y",
  ylab = NULL,
  w = qqqAxisLength(vec, factor = 0.25),
  h = 5,
  ...
)

Arguments

vec

The variable to plot.

also.pdf

Save plot in both png and pdf formats.

save.obj

Save the ggplot object to a file. Default: FALSE.

ext

File extension (.pdf / .png).

plot

Display the plot.

plotname

The title of the plot and the name of the file (unless specified in filename).

subtitle

Optional subtitle text added below the title. Default is NULL.

suffix

Optional suffix added to the filename. Default is NULL.

caption

Optional text added to bottom right corner of the plot. Default = suffix

filename

Manually provided filename (optional). Default: parse from plotname,

save

Save the plot into a file.

mdlink

Insert a .pdf and a .png image link in the markdown report, set by "path_of_report".

hline

Draw a horizontal line on the plot.

filtercol

Color bars below / above the threshold with red / green. Define the direction by -1 or 1. Takes effect if "*line" is defined.

palette_use

GGpubr Color palette to use.

col

Color of the plot.

xlab

X-axis label. Default: "".

xlab.angle

Rotate X-axis labels by N degree. Default: 90

logY

Make Y axis log10-scale.

ylim

ylimit values

annotation_logticks_Y

Logical indicating whether to add annotation logticks on Y-axis. Default follows the value of logY.

label

label

hide.legend

Hide legend. Default: TRUE.

legend.title

Custom legend title. Provide a string.

max.names

The maximum number of names still to be shown on the axis.

limitsize

limitsize

grid

Character indicating the axis to add gridlines. Options are 'x', 'y', or 'xy'. Default is 'y'.

ylab

Y-axis label. Default: NULL.

w

Width of the plot.

h

Height of the plot.

...

Pass any other parameter of the corresponding plotting function(most of them should work).

Examples

weight3 <- runif(12)
qbarplot(weight3, filtercol = -1, hline = .5)
qbarplot(weight3, filtercol = 1, hline = .5)

vertesy/ggExpress documentation built on Nov. 24, 2024, 10:44 p.m.