agg_qplot: Quick plot - for quickly creates a single-panel graph....

Description Usage Arguments See Also Examples

View source: R/qplot.R

Description

Quick plot - for quickly creates a single-panel graph. Supports bar and line (and combinations of).

Usage

1
2
3
4
5
6
agg_qplot(data, series = NULL, x = NULL, bars = FALSE,
  filename = NULL, title = NULL, subtitle = NULL, footnotes = c(),
  sources = c(), yunits = NULL, col = list(), pch = list(),
  lty = list(), lwd = list(), xlim = NULL, ylim = NULL,
  legend = FALSE, legend_ncol = NA, stacked = TRUE, bar.stacked,
  legend.ncol)

Arguments

data

Object containing the series you want to plot. Can be a 'data.frame', 'tibble', 'zoo', 'xts' or 'ts'.

series

A vector of series names specifying which subset of series you want to plot.

x

The x variable for your plot. Not required for 'ts', 'xts' and 'zoo' data because they use the dates in the time series.

bars

(optional) Vector of string names indicating which series should be bars, rather than lines. Alternatively, if you set 'bars = TRUE' all series will plot as bars.

filename

(optional) If specified, save image to filename instead of displaying in R. Supports svg, pdf, emf, emf+ and png extensions.

title

(optional) A string indicating the title for the graph. Passing 'NULL' (or omitting the argument) will suppress printing of title.

subtitle

(optional) A string indicating the subtitle for the graph. Passing 'NULL' (or omitting the argument) will suppress printing of subtitle.

footnotes

(optional) A vector strings, corresponding to the footnotes, in order.

sources

(optional) A vector of strings, one entry for each source.

yunits

(optional) A string indicating the units to be used. If not supplied, a % sign will be used.

col

(optional) A list of string -> misc pairs. The keys should be series names, and the values colours for each series (any colour accepted by R is fine.) You need not supply colours for all series. Default colours will be assigned (cycling through) to series without assigned colours. Alternatively, you can supply a single value to apply to all series.

pch

(optional) Markers for your series. Passed as with 'col'. Defaults to none (NA).

lty

(optional) Line types for each series. Passed as with 'col'. Defaults to solid (1).

lwd

(optional) Line width, relative to default, for each series. Passed as with 'col'.

xlim

(optional) c(numeric, numeric) Gives the x limits (in years) for the graph.

ylim

(optional) A list(min = numeric, max = numeric, nsteps int). If unsupplied, a suitable default is chosen.

legend

A logical indicating whether to add a legend to the graph (default FALSE).

legend_ncol

(optional) How many columns do you want the legend to have (if NA, which is the default, arphit will guess for you).

stacked

(optional) Logical indicating whether the bar series should be stacked (TRUE, default) or side-by-side (FALSE).

bar.stacked

(DEPRECATED) Alias for stacked

legend.ncol

(DEPRECATED) Alias for legend_ncol

See Also

vignette("qplot-options", package = "arphit") for a detailed description of all the plotting options and how they affect the output.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
T <- 24
randomdata <- ts(data.frame(x1 = rnorm(T),
                            x2 = rnorm(T),
                            x3 = rnorm(T, sd = 10),
                            x4 = rnorm(T, sd = 5)),
                 start = c(2000, 1),
                 frequency = 4)
agg_qplot(
  randomdata,
  title = "A Title",
  subtitle = "A subtitle",
  footnotes = c("a", "B"),
  sources = c("A Source", "Another source"),
  yunits = "index"
)

angusmoore/arphit documentation built on Feb. 15, 2021, 9:40 a.m.