plotstyle.add: Adds plot styles locally to plotstyle.csv

View source: R/plotstyle.add.R

plotstyle.addR Documentation

Adds plot styles locally to plotstyle.csv

Description

Adds plot styles locally as a per-session setting and returns a dataframe with all plot styles including the added data.

Usage

plotstyle.add(
  entity,
  legend,
  color,
  marker = NULL,
  linestyle = NULL,
  replace = FALSE,
  write_file = FALSE
)

Arguments

entity

Vector of strings with names of entities (regions, variable names, etc.)

legend

Vector of strings with legend names of entities.

color

Vector of strings containing hexadecimal color codes.

marker

optional Vector of strings with marker codes.

linestyle

optional Vector of strings containing linestyle codes.

replace

Logical (default FALSE) indicating whether existing data should be replaced with new data.

write_file

If TRUE, the updated plot styles are write to the file plotstyles.csv in the current working directory.

Details

By default, plot styles of already existing entities will not be changed. Only new entities will be added. Use the replace switch to replace existing styles. If you want to keep the legend text or the color of an already existing entity and only replace one of the two values, use the string "keep" for the value you want to keep.

To change plot styles permanently, use the writefile argument to write the updated plot styles to a .csv file, use it to update ./inst/extdata/plotstyle.csv, and build a new package version.

Author(s)

David Klein, Jan Philipp Dietrich

See Also

plotstyle()

Examples

## Not run: plotstyle.add("AFR", "Africa", "#000000")
## Not run: plotstyle.add("AFR", "keep",   "#FFFFFF")
## Not run: plotstyle.add("AFR", "keep",   "keep", marker = 20, replace = TRUE)


pik-piam/mip documentation built on April 13, 2025, 5:45 p.m.