plotIndDot: Dot plots of single indicator with highlighting

Description Usage Arguments Value Examples

View source: R/coin_indplot.R

Description

Plots a single indicator as a line of dots, and optionally highlights a selected unit.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotIndDot(
  COIN,
  dset = NULL,
  icode = NULL,
  usel = NULL,
  use_group = NULL,
  marker_type = "circle",
  add_stat = NULL,
  stat_label = NULL,
  show_ticks = TRUE,
  plabel = NULL,
  usel_label = TRUE,
  vert_adjust = 0.5
)

Arguments

COIN

The COIN

dset

The source data set to use for indicator data

icode

An indicator code to plot.

usel

A unit or set of units (as a string or character vector) to highlight.

use_group

The name of a grouping column which must be present in the specified data set. If this is specified, the plot will be restricted to only include units within the group(s) to which usel belongs. This argument can also be specified as a list - see function documentation for getIn().

marker_type

The type of marker, either "circle" (default) or "cross", or a marker number to pass to ggplot2 (0-25).

add_stat

A statistic to overlay, either "mean", "median" or else a specified value.

stat_label

An optional string to use as label at the point specified by add_stat.

show_ticks

Set FALSE to remove axis ticks.

plabel

Controls the labelling of the indicator. If not specified, returns the indicator name, plus units if found. Otherwise if "indname", returns only indicator name, if "indname+unit", returns indicator name plus unit (if found), if "unit" returns only unit (if found), otherwise if "none", displays no text. Finally, any other string can be passed, so e.g. "My indicator" will display this on the axis.

usel_label

If TRUE (default) also labels selected units with their unit codes. FALSE to disable.

vert_adjust

Adjusts the vertical height of text labels and stat lines, which matters depending on plot size. Takes a value between 0 to 2 (higher will probably remove the label from the axis space).

Value

Plots generated with ggplot2. These can be edited further with ggplot2 commands.

Examples

1
2
3
4
5
# assemble ASEM COIN
ASEM <- assemble(ASEMIndData, ASEMIndMeta, ASEMAggMeta)
# plot CO2 indicator with highlighted countries plus median
plotIndDot(ASEM, dset = "Raw", icode = "CO2",
  usel = c("GBR", "ESP", "AUS"), add_stat = "median")

COINr documentation built on Nov. 30, 2021, 9:06 a.m.