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,
  first_color_on_bottom = TRUE,
  alpha_var = NULL,
  invert_bool = NULL,
  suppress_x_var_newline = TRUE
)

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.

alpha_var

Variable for setting the transparency of bars or line type of lines, coded to be used with year to ate.

invert_bool

Used to create population pyramid or import/export charts, specifies when to show data in the negative space of the y-axis.

suppress_x_var_newline

For categorical x-axis variables, remove any new line from the character string

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 Aug. 31, 2024, 12:35 a.m.