widebars: Wide bar plots

Description Usage Arguments Examples

View source: R/plot_special.R

Description

Create a series of barplots by grouping factor.

Usage

1
2
widebars(x, y, main = NULL, sub = NULL, foot = NULL, note = NULL,
  col = c("grey90", "grey30", "lightblue2", "dodgerblue2"))

Arguments

x

vector of grouping values

y

numeric vector of data values

main, sub

main title and sub title for plot

foot, note

footnote (left-adjusted) and note (right) for plot

col

a vector of colors for elements of the form c(section background, text, negative bars, positive bars)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
op <- par(oma = c(5,5,7,5), mar = c(5,0,3,.1), las = 1,
          fg = 'transparent', bg = 'grey98')
widebars(mtcars$gear, mtcars$mpg * sample(c(-1,1), 32, replace = TRUE),
         'Motor Trend car road tests', 'Miles per gallon by gear',
         'some footnote that is not important', 'blahblah')

par(oma = c(5,5,7,5), mar = c(5,0,3,.1), las = 1,
    fg = 'transparent', bg = 'grey98')
widebars(x <- rep(2004:2015, each = 4), rnorm(48),
         main = paste('Market value,', paste0(range(x), collapse = ' - ')),
         sub = 'Percent change, quarterly',
         foot = paste('Values current as of', format(Sys.time(), '%b %Y')),
         note = 'github.com/raredd')
par(op)

raredd/plotr documentation built on Nov. 13, 2018, 7:05 a.m.