cshp_mult {demcon}R Documentation

Mapping cshapes Multiples

Description

Create a sequence of cshapes maps highlighting changes in nation-state independence.

Usage

cshp_mult(
  dates,
  cowcodes,
  bb,
  jitter_labs = TRUE,
  highlight = "#00dada",
  lat_grat = round(as.numeric(abs(bb[2] - bb[4])/4)),
  long_grat = round(as.numeric(abs(bb[1] - bb[3])/4)),
  lab_size = 3
)

Arguments

dates

A vector of dates indicating time-steps of interest. Each element must be formatted with as.Date(YYYY-M-D).

cowcodes

A vector, or list, of Correlates of War numeric country codes to highlight at each corresponding timestep specified in date. The length of dates and cowcodes must be equal. Multiple countries can be highlighted at a given timestep by using a list.

bb

A bounding box to crop the the global cshapes map. Must be a named vector of the form c(xmin=long, ymin=lat, xmax=long, ymax=lat).

jitter_labs

Logical to toggle country label jittering with ggrepel::geom_text_repel().

highlight

Hex color value for country highlighting.

lat_grat

Numeric value for latitudinal graticule spacing.

long_grat

Numeric value for longitudinal graticule spacing.

lab_size

Numeric value for country label text size.

Details

The chsp_mult and plot.chsp_mult functions are currently experimental functions that are slated for future improvements to the interface, automated ease of use, and stability. Despite the testing procedures in place, they may produce odd results with certain combinations of dates, countries (cow_codes), and bounding boxes (bb).

Value

A list of ggplot2 plotting devices. Each element corresponds to an element of dates.

Examples


if(requireNamespace("cshapes")){
dates = c(
as.Date("1989-1-1"),
as.Date("1992-5-1"),
as.Date("1993-5-1"),
as.Date("2006-7-1"),
as.Date("2008-3-1")
)
cow_codes = list(345,
                 c(344, 346, 349),
                 343,
                 341,
                 347)

bb<-c(xmin=13,ymin=40,xmax=24,ymax=47)

balkans<-cshp_mult(dates = dates, cowcodes = cow_codes, bb = bb,jitter_labs = FALSE)}

[Package demcon version 0.3.0 Index]