Learn R Programming

ggplayfair (version 0.1.1)

geom_balance_of_trade: geom_balance_of_trade

Description

geom_balance_of_trade() creates a custom ggplot2 ribbon that visualizes the balance of trade by shading the area between exports and imports.

Usage

geom_balance_of_trade(
  data = NULL,
  mapping = NULL,
  stat = StatBalanceOfTrade,
  geom = GeomBalanceOfTrade,
  position = "identity",
  ...,
  na.rm = FALSE,
  show.legend = NA
)

Value

A ggplot2 layer representing the balance of trade. Within the layer with be a colored ribbon and two lines and point sets representing your imports and exports

Arguments

data

A data frame (defaults to the plot-level data)

mapping

Set of aesthetic mappings, see geom_ribbon

stat

Stat to use (defaults to StatBalanceOfTrade)

geom

Geom to use (defaults to GeomBalanceOfTrade)

position

Position adjustment

...

Other arguments passed on to the layer (e.g. na.rm)

na.rm

If TRUE, remove NAs

show.legend

Should this layer be included in the legend?