build_plot: Adds a geom layer to a ggplot object based on user input.

View source: R/Plot_Style.R

build_plotR Documentation

Adds a geom layer to a ggplot object based on user input.

Description

Adds a geom layer to a ggplot object based on user input.

Usage

build_plot(
  data,
  chart_geom = "Line Chart",
  share = FALSE,
  x_var = NULL,
  y_var = "None",
  color_var = "None",
  facet_var = "None",
  second_var = NULL,
  legend = TRUE,
  caption = TRUE,
  labels_and_colors = NULL,
  column_key = NULL,
  format = FALSE,
  ytextposition = FALSE,
  reverse_color = FALSE,
  alpha_var = NULL
)

Arguments

data

A tibble of formatted data for the ggplot

chart_geom

choose from Line Chart or Bar Chart; defaults to Line Chart

share

If TRUE, calculates the share

x_var

The name of fiscal year variable, as string

y_var

The name of variable to plot on y-axis

color_var

The name of the coloration variable, as string

facet_var

The name of facet variable, as string

second_var

The name of the secondary facet variable, as string

legend

If TRUE, includes a legend

caption

If TRUE, includes a source caption

labels_and_colors

A csis360 lookup data.frame with factor information

column_key

A csis360 lookup data.frame with column information

format

If TRUE, summarize the data.frame

ytextposition

If TRUE, add ytextposition to allow for geom_text overlays.

reverse_color

If TRUE, the order of the color variable is flipped

Details

Intended to handle ggplot settings that depend on user input. Settings that apply universally should be added in server.R.

Value

A ggplot object including user-specified geom layer


CSISdefense/csis360 documentation built on May 10, 2024, 1:20 a.m.