variable_plot: variable_plot

View source: R/variable_plot.R

variable_plotR Documentation

variable_plot

Description

Plots variables (multiple "y" values) broken out as vertical facets.

Usage

variable_plot(
  data,
  x,
  y,
  group = NULL,
  facet_x = NULL,
  palette = ez_col,
  size = 14,
  labels_y = ez_labels,
  geom = "line",
  size_line = 1,
  legend_ncol = NULL,
  ylab = NULL,
  yoy = FALSE,
  switch = "y",
  rescale_y = 1
)

Arguments

data

A data.frame.

x

A named character value. Evaluates to a column.

y

A named character value. Evaluates to a column.

group

A character value. Evaluates to a column.

facet_x

A character value. Evaluates to a column.

palette

Colour function.

size

theme size for use_theme(). Default is 14.

labels_y

label formatting function

geom

Either "line", "col" or "bar". Default is "line"

size_line

width of line for geom_line(). Default is 1.

legend_ncol

Number of columns in legend.

ylab

y label text

yoy

Logical used to indicate whether a YOY grouping should be created. Default is FALSE.

switch

Option to switch location of variable (facet) labels. Default is 'y' (yes) which shows facet strips on left side of panels.

rescale_y

Rescaling factor for y-axis limits

Examples

suppressPackageStartupMessages(library(tsibble))
library(tsibbledata)
variable_plot(ansett, "Week", "Passengers", facet_x = "Class")
variable_plot(ansett, "Week", "Passengers", facet_x = "Class", yoy = TRUE)
variable_plot(pelt, "Year", c("Lynx", "Hare"), "round(Year, -1)")
variable_plot(hh_budget, "Year", c("Debt", "Expenditure"), "Country")
variable_plot(PBS, "Type", "Scripts", "Concession", switch = "y", geom = "col")
## Not run: 
variable_plot(subset(hh_budget, Year > 2013), "Year",
              c("Debt\n(% of disposable income)" = "Debt",
                "Expenditure\nGrowth (%)" = "Expenditure",
                "Unemployment (%)" = "Unemployment"),
               facet_x = "Country", geom = "bar")
variable_plot(subset(hh_budget, Year > 2013), "Year",
              c("Debt\n(% of disposable income)" = "Debt",
                "Expenditure\nGrowth (%)" = "Expenditure",
                "Unemployment (%)" = "Unemployment"),
               group = "Country", geom = "bar")

## End(Not run)

ezplot documentation built on Nov. 26, 2023, 5:07 p.m.