plotstyle: Returns plot styles for given entities

View source: R/plotstyle.R

plotstyleR Documentation

Returns plot styles for given entities

Description

Returns a named vector (using entity names) with style codes (e.g. colors) for given entities.

Usage

plotstyle(
  ...,
  out = "color",
  unknown = NULL,
  plot = FALSE,
  verbosity = getOption("plotstyle.verbosity"),
  regexp = FALSE
)

Arguments

...

One or more strings or a vector of strings with names of entities (regions, variable names, etc.). Units in brackets "(US$2005/GJ)" will be ignored. If left empty all available entities will be used

out

Switch defining which type of plot style you want to get: Currently you can choose between "color", "legend" and "all" (the latter will return a dataframe with all available plot styles)

unknown

Optional data frame defining plot styles for unknown entities. A default color map will be used for unknown entities if nothing is provided here

plot

If TRUE plots with all given entities and their colors will be produced (to produce plots with all available entities leave the ... entry empty!)

verbosity

Set to 1 if you want to know for which unknown entities plotstyle brewed colors

regexp

If TRUE, match entities as regular expressions. Matching entities are expanded, non-matching entities are returned as the original expression. Does not generate default color maps. Implies plot = FALSE and verbosity = 0.

Value

Plot styles for given entities

Colors for unknown entities

colors.png

Author(s)

David Klein, Jan Philipp Dietrich

See Also

plotstyle.add

Examples

entities <- c("AFR", "AAA", "AFR", "UNKNOWN_ELEMENT2")
plotstyle(entities)
unknown <- data.frame(row.names = c("AAA", "UNKNOWN_ELEMENT2"),
                   color = c("#123456", "#345678"),
                   legend = c("l_AAA", "l_UNKNOWN_ELEMENT2"))
plotstyle(entities, unknown = unknown)
plotstyle(entities, out = "legend")
plotstyle(entities, out = "all")

# search for all 'Final Energy Biomass' entities
plotstyle("^Final Energy\\|.*Biomass", regexp = TRUE)

# search for all three-letter entities (a.k.a. regions)
plotstyle("^[A-Z]{3}$", regexp = TRUE, out = "all")

pik-piam/mip documentation built on April 5, 2024, 12:31 p.m.