buildLinePlot.Rd
This function builds a line plot given user specifications using ggplot2.
buildLinePlot(df, x, y, fill = "none", facet = "none", title = NULL, facetScales = "fixed", yLimits = c(NA, NA), yScales = "zero", scaleLabels = waiver())
df | A data frame with plot data |
---|---|
x | Name of x-variable (string) |
y | Name of y-variable (string) |
fill | Name of fill variable (string) |
facet | Name of facet variable (string) |
title | Title of plot (string) |
facetScales | Scale specification for subplots (fixed, free_y, free_x, free).
This value is passed to the |
yLimits | A vector specifying y-axis limits for use with
|
yScales | A string specifying y-axis scale type. Possible values are "zero" for a zero lower limit and upper limit fit to data, "manual" for a manual specification given by yLimits, or NULL for limits fit to data |
scaleLabels | Scale labels for y-variable (e.g., waiver(), scales::percent).
This value is passed to the |
A ggplot2 plot object
The plot labels are based on variable names. The
to_any_case
function is used to convert variable
names from the data frame in camel case to sentence case.
The y-variable values are divided by one thousand or one million when
appropriate to simplify axis labels. Scaling is performed using the
scaleVariable
function.
The y-axis labels are repeated for each
subplot using the facet_rep_wrap
function.
The barAndLinePal
function is used to map the fill variable
to a fill color.
If the maximum length of x-variable labels are greater than or equal to four, then the labels are rotated 45 degrees.
Other plot functions: buildBarPlot