area_plot {ezplot} | R Documentation |
area_plot
Description
Aggregates a data.frame and creates a stacked area chart.
Usage
area_plot(
data,
x,
y = "1",
group = NULL,
facet_x = NULL,
facet_y = NULL,
size = 11,
reorder = c("group", "facet_x", "facet_y"),
palette = ez_col,
labels_y = if (position == "fill") {
function(x) ez_labels(100 * x, append =
"%")
} else {
ez_labels
},
labels_x = NULL,
use_theme = theme_ez,
position = c("stack", "fill"),
facet_scales = "fixed",
facet_ncol = NULL,
legend_ncol = NULL,
env = parent.frame()
)
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. |
facet_y |
A character. Evaluates to a column. |
size |
theme size for |
reorder |
A character vector specifying the group variables to reorder.
Default is |
palette |
Colour function. |
labels_y |
label formatting function |
labels_x |
label formatting function |
use_theme |
ggplot theme function |
position |
Either |
facet_scales |
Option passed to scales argument in |
facet_ncol |
Option passed to ncol argument in |
legend_ncol |
Number of columns in legend. |
env |
environment for evaluating expressions. |
Value
A ggplot object.
Examples
library(tsibble)
library(tsibbledata)
area_plot(ansett, x = "as.Date(Week)", y = "Passengers")
area_plot(ansett,
x = "as.Date(Week)", y = c("Weekly Passengers" = "Passengers"), "Class")
area_plot(ansett, "as.Date(Week)",
y = c("Weekly Passengers" = "Passengers"),
group = "substr(Airports, 5, 7)",
facet_x = "substr(Airports, 1, 3)",
facet_y = "Class",
facet_scales = "free_y")