ani.barplot: Animated Barplot

View source: R/ani.barplot.R

ani.barplotR Documentation

Animated Barplot

Description

Creates an animation of a one dimensional frequency table or vector. Animation can be saved to a folder in several formats.

Usage

ani.barplot(
  x,
  col = "lightblue",
  ylab = "",
  xlab = "",
  main = "",
  ylim = c(0, max(x) + max(x)/6),
  box = TRUE,
  names = "",
  cex.names = par("cex.axis"),
  border = "black",
  space = 0.4,
  text = TRUE,
  cex = 1,
  coltext = 1,
  pre = "n =",
  post = "%",
  format = "png",
  digit = 2,
  frames = 100,
  folder = "",
  ani.text = TRUE,
  width = 1920,
  height = 1080,
  point = 8,
  res = 300,
  bg = TRUE,
  bg.from = "grey",
  bg.to = "white",
  bg.increase = TRUE,
  axes = TRUE,
  cex.axis = par("cex.axis")
)

Arguments

x

a vector or one dimensional frequwncy table of values describing the bars which make up the plot.

col

a vector of colors for the bars. By default col is set to "lightblue".

ylab

a label for the y axis

xlab

a label for the x axis

main

title of plot

ylim

limits for the y axis.

box

a logical value. If FALSE no box around plot will be drawn

names

a vector of names to be plotted below each bar. If this argument is left empty, the names are taken from the names freuqency table of x

cex.names

expansation of names below bars

border

color of bar border

space

space between bars

text

a logical value. If TRUE text will be drawn on bars

cex

expansation of text on bars

coltext

text color

pre

pre text of absolute frequencies on bars

post

post text of absolute frequencies on bars

format

the image output format e.g.: "png", "pdf", "jpeg", etc.

digit

the numer of decimal places to display relative frequencies with e.g.: digits=3 -> 22,2

frames

animation length in frames

folder

folder to save animation as png frames to. If "" no images will be saved

ani.text

a logical value. If TRUE text on bars will be animated as well. If FALSE no text on bars will apear.

width

png width (only works if format="png")

height

png height (only works if format="png")

point

png point size (only works if format="png")

res

png resolution px/in (only works if format="png")

bg

a logical value. If TRUE background will be drawn.

bg.from

background color starting color

bg.to

background color end color

bg.increase

a logical value. If TRUE background color will increase from bg.from to bg.to

axes

a logical value. If TRUE axes will be drawn.

cex.axis

text size of axis

Examples

x<-sample(paste("group",letters[1:5]),200,T)
ani.barplot(prop.table(table(x)))

ingmarboeschen/graphing documentation built on Jan. 14, 2025, 7:32 a.m.