gta_plot_wrapper: Define plot settings for ggplot.

View source: R/gta plot wrapper.R

gta_plot_wrapperR Documentation

Define plot settings for ggplot.

Description

This function wraps ggplot settings in a wrapper function.

Usage

gta_plot_wrapper(
  data = NULL,
  data.x = NULL,
  data.y = NULL,
  group = NULL,
  plot.title = NULL,
  plot.subtitle = NULL,
  x.data.type = "continuous",
  x.bottom.name = NULL,
  x.bottom.breaks = waiver(),
  x.bottom.limits = NULL,
  x.bottom.labels = waiver(),
  x.bottom.expand = c(0.02, 0.02),
  x.top.enable = F,
  x.top.transform = 1,
  x.top.name = x.bottom.name,
  x.top.breaks = x.bottom.breaks,
  x.top.limits = x.bottom.limits,
  x.top.labels = waiver(),
  y.data.type = "continuous",
  y.left.name = NULL,
  y.left.breaks = waiver(),
  y.left.limits = NULL,
  y.left.labels = waiver(),
  y.left.expand = c(0.02, 0.02),
  y.right.enable = T,
  y.right.transform = 1,
  y.right.name = y.left.name,
  y.right.breaks = y.left.breaks,
  y.right.limits = y.left.limits,
  y.right.labels = y.left.labels,
  colour.palette = gta_colour$qualitative,
  colour.labels = waiver(),
  colour.legend.title = waiver(),
  colour.legend.col = 1,
  colour.legend.enable = T,
  fill.palette = gta_colour$qualitative,
  fill.labels = waiver(),
  fill.legend.title = waiver(),
  fill.legend.col = 1,
  fill.legend.enable = T,
  flip.plot = F,
  facet.var = NULL,
  facet.ncol = 1,
  facet.nrow = 1,
  x.highlight.range = NULL,
  x.highlight.colour = gta_colour$grey[1],
  x.highlight.title = NULL,
  x.highlight.alpha = 0.2,
  y.highlight.range = NULL,
  y.highlight.colour = gta_colour$grey[1],
  y.highlight.title = NULL,
  y.highlight.alpha = 0.2
)

Arguments

plot.title

Define the plot title as string. Default: emtpy.

plot.subtitle

Define the plot subtitle as string. Default: emtpy.

x.data.type

Define the type of data fed to the x-axis. Applicable values are "continuous" or "discrete". This will affect the use of scale_x_continuous or scale_x_discrete respectively. Default: "continuous".

x.bottom.name

Define the bottom x-axis name. Default: empty.

x.bottom.breaks

Define the bottom x-axis breaks. Default: ggplot automatic.

x.bottom.limits

Define the bottom x-axis limits. Default: ggplot automatic.

x.bottom.labels

Define the bottom x-axis limits. Options are percent or ???. Default: no labels.

x.bottom.expand

Expand the plot area some percentage additional to the data. Takes in a vector of type e.g. c(0.5, 0.5) for top and bottom expansion in percentage. Default: 5 Percent.

x.top.enable

Enable a secondary x-axis on the top. Default: FALSE.

x.top.transform

Transform top x-axis by multiplying it with a integer. Default: No transformation = 1.

x.top.name

Change name of top x-axis. If undefined, value will be taken from bottom x-axis.

x.top.breaks

Change breaks of top x-axis. If undefined, value will be taken from bottom x-axis.

x.top.limits

Change limits of top x-axis. If undefined, value will be taken from bottom x-axis.

x.top.labels

Change labels of top x-axis. If undefined, value will be taken from bottom x-axis.

y.data.type

Define the type of data fed to the y-axis. Applicable values are "continuous" or "discrete". This will affect the use of scale_y_continuous or scale_y_discrete respectively. Default: "continuous".

y.left.name

Define the left y-axis name. Default: empty.

y.left.breaks

Define the left y-axis breaks. Default: ggplot automatic.

y.left.limits

Define the left y-axis limits. Default: ggplot automatic.

y.left.labels

Define the left y-axis labels. Options are percent or ???. Default: no labels.

y.left.expand

Expand the plot area some percentage additional to the data. Takes in a vector of type e.g. c(0.5, 0.5) for left and right expansion in percentage. Default: 5 Percent.

y.right.enable

Enable a secondary y-axis on the right. Default = T.

y.right.transform

Transform right y-axis by multiplying it with a integer. Default: No transformation = 1.

y.right.name

Change name of right y-axis. If undefined, value will be taken from left y-axis.

y.right.breaks

Change breaks of right y-axis. If undefined, value will be taken from left y-axis.

y.right.limits

Change limits of right y-axis. If undefined, value will be taken from left y-axis.

y.right.labels

Change labels of right y-axis. If undefined, value will be taken from left y-axis.

colour.palette

Define the colour scheme of colour type. Applicable values are: harmful, liberalising, qualitative, or any colour vector in the gta colour palette.

colour.labels

Define the labels for the colour legend as vector. Default: ggplot automatic.

colour.legend.title

Define the title of the colour legend as string. Default: ggplot automatic.

colour.legend.col

Define the number of columns for the colour legend. Default: 1.

fill.palette

Define the colour scheme of colour type. Applicable values are: harmful, liberalising, qualitative, or any colour vector in the gta colour palette.

fill.labels

Define the labels for the fill legend as vector. Default: ggplot automatic.

fill.legend.title

Define the title for the fill legend as string. Default: ggplot automatic.

fill.legend.col

Define the number of columns for the fill legend. Default: 1.

flip.plot

Flip the x and y axis, takes in a TRUE or FALSE value. Default: FALSE.

facet.var

Takes in the column (e.g. dataframe$col) to make facets of.

facet.ncol

Takes in the number of facet columns as integer. Default: 1.

facet.nrow

Takes in the number of facet rows as integer. Default: 1.

x.highlight.range

Define a range as a vector 'c(start, end)'

x.highlight.colour

Define the color as a HEX code or use the gta_colour_palette

x.highlight.title

Define the title for the highlighted x range.

x.highlight.alpha

Define the transparency for the highlight from 0 to 1. Default is 0.2.

y.highlight.range

Define a range as a vector 'c(start, end)'

y.highlight.colour

Define the color as a HEX code or use the gta_colour_palette

y.highlight.title

Define the title for the highlighted y range.

y.highlight.alpha

Define the transparency for the highlight from 0 to 1. Default is 0.2.

Author(s)

Global Trade Alert

References

www.globaltradealert.org


global-trade-alert/gtalibrary documentation built on April 26, 2024, 12:38 p.m.