| Title: | Graphical Elements of the University of Konstanz's Corporate Design |
|---|---|
| Description: | Define and use graphical elements of corporate design manuals in R. The 'unikn' package <doi:10.5281/zenodo.7096191> provides color functions (by defining dedicated colors and color palettes, and commands for finding, changing, viewing, and using them) and styled text elements (e.g., for marking, underlining, or plotting colored titles). The pre-defined range of colors and text decoration functions is based on the corporate design of the University of Konstanz <https://www.uni-konstanz.de/>, but can be adapted and extended for other purposes or institutions. |
| Authors: | Hansjoerg Neth [aut, cre] (ORCID: <https://orcid.org/0000-0001-5427-3141>), Nico Gradwohl [aut] (ORCID: <https://orcid.org/0000-0002-8703-905X>) |
| Maintainer: | Hansjoerg Neth <[email protected]> |
| License: | CC BY-SA 4.0 |
| Version: | 1.1.0.9006 |
| Built: | 2026-11-30 13:25:25 UTC |
| Source: | https://github.com/hneth/unikn |
ac adjusts the transparency of a color or color palette col
to an opacity level alpha (in [0, 1]).
ac(col, alpha = 0.5, use_names = TRUE)ac(col, alpha = 0.5, use_names = TRUE)
col |
A (required) color or color palette (as a vector). |
alpha |
A factor modifying the opacity alpha
(as |
use_names |
A logical value indicating whether color names should be adjusted
to include the values of |
ac is mostly a wrapper for adjustcolor
of the grDevices package, but allows for more flexible
combinations of (multiple) col and alpha values.
The name ac is an abbreviation of "adjust color",
but is also a mnemonic aid for providing "air conditioning".
A color vector of the same length as col,
transformed by adjustcolor.
seecol for plotting/seeing color palettes;
usecol for using color palettes;
simcol for finding similar colors;
newpal for defining new color palettes;
grepal for finding named colors.
Other color functions:
demopal(),
grepal(),
newpal(),
plot_cube(),
seecol(),
shades_of(),
simcol(),
usecol()
ac("black") # using alpha = .5 by default # multiple colors: cols <- ac(c("black", "gold", "deepskyblue"), alpha = .50) seecol(cols, main = "Transparent colors") # multiple alphas: blacks <- ac("black", alpha = 5:0/5) seecol(blacks, main = "One col several alpha values") bgc <- ac(c("black", "gold"), alpha = 1:6/6) seecol(bgc, main = "More alpha values than cols") # Using a color palette: seecol(ac(pal_unikn_pref, 2/3), main = "Adding color transparency by ac()") # Color names: seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = TRUE)) seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = FALSE))ac("black") # using alpha = .5 by default # multiple colors: cols <- ac(c("black", "gold", "deepskyblue"), alpha = .50) seecol(cols, main = "Transparent colors") # multiple alphas: blacks <- ac("black", alpha = 5:0/5) seecol(blacks, main = "One col several alpha values") bgc <- ac(c("black", "gold"), alpha = 1:6/6) seecol(bgc, main = "More alpha values than cols") # Using a color palette: seecol(ac(pal_unikn_pref, 2/3), main = "Adding color transparency by ac()") # Color names: seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = TRUE)) seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = FALSE))
Bordeaux provides the preferred color of pal_bordeaux
(as an atomic HEX character value) and is defined as
pal_bordeaux[[4]].
BordeauxBordeaux
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_bordeaux for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Grau,
Karpfenblau,
Peach,
Petrol,
Pinky,
Seeblau,
Seegruen,
Signal
Bordeaux # HEX character "#8E2043" (as value) all.equal(Bordeaux, pal_bordeaux[[4]]) # TRUE (same HEX values) seecol(Bordeaux) # view color and detailsBordeaux # HEX character "#8E2043" (as value) all.equal(Bordeaux, pal_bordeaux[[4]]) # TRUE (same HEX values) seecol(Bordeaux) # view color and details
demopal provides an example plot of some type
to illustrate a color palette pal.
demopal(pal = pal_unikn, type = NA, pal_name = NULL, seed = NULL, ...)demopal(pal = pal_unikn, type = NA, pal_name = NULL, seed = NULL, ...)
pal |
A color palette (to be illustrated),
provided as a color vector, a palette (data frame), or
the name of a palette object (as a character string,
e.g., |
type |
The type of plot to be used (as a character string or integer value).
Permissible types are
|
pal_name |
A name for the input color palette |
seed |
A random seed value (for reproducible randomness),
passed to the |
... |
Auxiliary arguments passed to |
The demopal wrapper function passes a range of arguments to more specific functions.
Common arguments include:
col_par Default color for par(col);
alpha Default value for color transparency (in 0:1);
n A scaling parameter (for random data generation);
main plot title (on top);
sub plot subtitle (on right margin);
seed A random seed value (for reproducible randomness).
The fit between a color palette pal and plot type
depends on the uses of colors in a plot.
For instance, overlaps of transparent color areas can be evaluated
with plot type = "curve" or plot type = "scatter"
(and 0 < alpha < 1).
Some functions additionally accept type-specific arguments
(e.g., beside, horiz, and as_prop, for plot type = "bar",
and cex for plot type = "scatter").
The type-specific functions usually generate some random data
(scaled by a parameter n) that is being plotted.
This data is returned (as an invisible R object)
to enable a plot's reconstruction.
The random data that was plotted (as an invisible R object);
for several types, a named list of the data of each plot.
seepal for plotting color palettes;
usecol for using color palettes;
shades_of to defining shades of a given color;
ac for adjusting color transparency;
pal_unikn for the default uni.kn color palette.
Other color functions:
ac(),
grepal(),
newpal(),
plot_cube(),
seecol(),
shades_of(),
simcol(),
usecol()
demopal(pal = pal_petrol, type = 1) my_pal <- c(rev(pal_pinky), pal_seeblau) # Selecting plot type: demopal(my_pal, type = 2) # by numeric index demopal(my_pal, type = "polygon") # by name demopal(my_pal, type = "shapes") # colored shapes # Passing a palette by its name (as a character string): demopal("pal_seeblau", type = "bar") # Several plot types at once (arranged in a grid): demopal(pal_petrol, type = c("bar", "scatter", "shapes")) demopal(pal_unikn, type = "all", seed = 101) # every type (reproducible) # Passing type-specific arguments: demopal(type = "scatter", col_par = "black", n = 200, cex = c(2, 4, 6), seed = 101)demopal(pal = pal_petrol, type = 1) my_pal <- c(rev(pal_pinky), pal_seeblau) # Selecting plot type: demopal(my_pal, type = 2) # by numeric index demopal(my_pal, type = "polygon") # by name demopal(my_pal, type = "shapes") # colored shapes # Passing a palette by its name (as a character string): demopal("pal_seeblau", type = "bar") # Several plot types at once (arranged in a grid): demopal(pal_petrol, type = c("bar", "scatter", "shapes")) demopal(pal_unikn, type = "all", seed = 101) # every type (reproducible) # Passing type-specific arguments: demopal(type = "scatter", col_par = "black", n = 200, cex = c(2, 4, 6), seed = 101)
get_col_names gets color names from color palettes.
get_col_names(col, custom_pals = all_pals)get_col_names(col, custom_pals = all_pals)
col |
A vector of colors. |
custom_pals |
A vector of color palettes. |
A vector of color names.
Grau provides the preferred color of pal_grau
(as an atomic HEX character value) and is defined as
pal_grau[[3]].
GrauGrau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_grau for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Karpfenblau,
Peach,
Petrol,
Pinky,
Seeblau,
Seegruen,
Signal
Grau # HEX character "#9AA0A7" (as value) all.equal(Grau, pal_grau[[3]]) # TRUE (same HEX values) seecol(Grau) # view color and detailsGrau # HEX character "#9AA0A7" (as value) all.equal(Grau, pal_grau[[3]]) # TRUE (same HEX values) seecol(Grau) # view color and details
grepal returns a vector of colors whose names match a regular expression (regex).
grepal(pattern, x = colors(), ignore_case = TRUE, plot = TRUE)grepal(pattern, x = colors(), ignore_case = TRUE, plot = TRUE)
pattern |
A regular expression (specified as a string/character object). |
x |
A vector of R color names or a data frame of named colors
(i.e., whose names can be searched).
Default: |
ignore_case |
Should the case of pattern be ignored
(passed to |
plot |
Boolean: Plot the output (using |
By default, the base R vector of named colors (i.e., colors()) is searched
for names matching a pattern (which can be a simple string or regular expression).
If x (i.e., the object to be searched) is provided,
it is must be a vector of color names or a data frame of named color objects
(i.e., a color palette).
If plot = TRUE, grepal also visualizes the detected colors
(by passing its result to seecol, as a side-effect).
This function facilitates searching colors by name and
yields (a vector of) colors of similar color hue (provided
that the color's hue is expressed in a color's name).
Its name grepal is an abbreviation of grep and "pal".
seecol for viewing and comparing color palettes;
usecol for using color palettes;
simcol for finding similar colors;
newpal for defining new color palettes;
shades_of to defining shades of a given color;
ac for adjusting color transparency;
pal_unikn for the default uni.kn color palette.
Other color functions:
ac(),
demopal(),
newpal(),
plot_cube(),
seecol(),
shades_of(),
simcol(),
usecol()
grepal("tan") # With regular expressions: some_grey <- grepal("gr(a|e)y", plot = FALSE) start_grey <- grepal("^gr(a|e)y", plot = FALSE) only_grey <- grepal("^gr(a|e)y$", plot = FALSE) length(some_grey) length(only_grey) # With other color objects (df as x): grepal("blau", x = pal_unikn) grepal("SEE", x = pal_unikn_pref, ignore_case = FALSE) # Applications: seecol(grepal("white"), col_bg = "lightblue2", main = "See 'white' colors()") olives <- grepal("olive", plot = FALSE) oranges <- grepal("orange", plot = FALSE) seecol(list(olives, oranges), pal_names = c("olives", "oranges"), main = "Comparing olives and oranges")grepal("tan") # With regular expressions: some_grey <- grepal("gr(a|e)y", plot = FALSE) start_grey <- grepal("^gr(a|e)y", plot = FALSE) only_grey <- grepal("^gr(a|e)y$", plot = FALSE) length(some_grey) length(only_grey) # With other color objects (df as x): grepal("blau", x = pal_unikn) grepal("SEE", x = pal_unikn_pref, ignore_case = FALSE) # Applications: seecol(grepal("white"), col_bg = "lightblue2", main = "See 'white' colors()") olives <- grepal("olive", plot = FALSE) oranges <- grepal("orange", plot = FALSE) seecol(list(olives, oranges), pal_names = c("olives", "oranges"), main = "Comparing olives and oranges")
heading plots 1 or more text strings (provided as a character vector labels)
as a heading to an (existing or new) plot and places a colored box behind
each label to mark it (i.e., highlighting the heading).
heading( labels, x = 0, y = 0.8, x_layout = NA, y_layout = "flush", col = "black", col_bg = "default", cex = 2, font = 2, new_plot = "slide" )heading( labels, x = 0, y = 0.8, x_layout = NA, y_layout = "flush", col = "black", col_bg = "default", cex = 2, font = 2, new_plot = "slide" )
labels |
A character vector specifying the text labels to be plotted. |
x |
A numeric vector of x-coordinates at which the
text labels in |
y |
A numeric vector of y-coordinates at which the
text labels in |
x_layout |
An optional numeric vector or character string
to control the horizontal positions of |
y_layout |
A numeric value or character string
to control the vertical positions of |
col |
The color(s) of the text label(s).
Default: |
col_bg |
The color(s) to highlight or fill the rectangle(s) with.
Default: |
cex |
Numeric character expansion factor(s),
multiplied by |
font |
The font type(s) to be used.
Default: |
new_plot |
Boolean: Should a new plot be generated?
Set to |
Text formatting parameters (like col, col_bg, cex, font)
are recycled to match length(labels).
heading uses the base graphics system graphics::.
slide and xbox to create simple plots (without text).
heading(labels = c("This is a headline", "containing two lines.")) # Note the warning: heading(labels = c("Headlines", "with 3 or more lines", "should not be arranged", "in such a step-wise fashion.")) # Avoiding the warning: heading(labels = c("Headlines with", "3 or more lines should", "not be arranged", "in a step-wise fashion.")) # Using non-default colors: heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.6, col = "white", col_bg = usecol(c(Pinky, Seegruen, Bordeaux, Karpfenblau))) # Using x_layout and y_layout: heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.6, col = "white", col_bg = usecol(pal_pinky[2:5]), x = NA, y = .6, x_layout = "right", y_layout = "flush") #' @family text functionsheading(labels = c("This is a headline", "containing two lines.")) # Note the warning: heading(labels = c("Headlines", "with 3 or more lines", "should not be arranged", "in such a step-wise fashion.")) # Avoiding the warning: heading(labels = c("Headlines with", "3 or more lines should", "not be arranged", "in a step-wise fashion.")) # Using non-default colors: heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.6, col = "white", col_bg = usecol(c(Pinky, Seegruen, Bordeaux, Karpfenblau))) # Using x_layout and y_layout: heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.6, col = "white", col_bg = usecol(pal_pinky[2:5]), x = NA, y = .6, x_layout = "right", y_layout = "flush") #' @family text functions
Karpfenblau provides the preferred color of pal_karpfenblau
(as an atomic HEX character value) and is defined as
pal_karpfenblau[[4]].
KarpfenblauKarpfenblau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_karpfenblau for the corresponding color palette;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
pal_unikn for the default uni.kn color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Peach,
Petrol,
Pinky,
Seeblau,
Seegruen,
Signal
Karpfenblau # HEX character "#3E5496" (as value) all.equal(Karpfenblau, pal_karpfenblau[[4]]) # TRUE (same HEX values) seecol(Karpfenblau) # view color and detailsKarpfenblau # HEX character "#3E5496" (as value) all.equal(Karpfenblau, pal_karpfenblau[[4]]) # TRUE (same HEX values) seecol(Karpfenblau) # view color and details
mark plots 1 or more text strings (provided as a character vector labels)
to an (existing or new) plot and places a colored box behind
each label to mark it (i.e., highlight or make it stand out from the background).
mark( labels, x = 0, y = 0.55, x_layout = NA, y_layout = "even", col = "black", col_bg = Seeblau, cex = 2, font = 2, new_plot = "none" )mark( labels, x = 0, y = 0.55, x_layout = NA, y_layout = "even", col = "black", col_bg = Seeblau, cex = 2, font = 2, new_plot = "none" )
labels |
A character vector specifying the text labels to be plotted. |
x |
A numeric vector of x-coordinates at which the
text labels in |
y |
A numeric vector of y-coordinates at which the
text labels in |
x_layout |
An optional numeric vector or character string
to control the horizontal positions of |
y_layout |
A numeric value or character string
to control the vertical positions of |
col |
The color(s) of the text label(s).
Default: |
col_bg |
The color(s) to highlight or fill the rectangle(s) with.
Default: |
cex |
Numeric character expansion factor(s),
multiplied by |
font |
The font type(s) to be used.
Default: |
new_plot |
Should a new plot be generated?
Set to |
The positions of the text elements in labels can be specified by
providing their coordinates (as x and y arguments) or
by providing an initial position and an y_layout (see below).
Text formatting parameters (like col, col_bg, cex, font)
are recycled to match length(labels).
mark uses the base graphics system graphics::.
slide and xbox to create simple plots (without text).
Other text functions:
post(),
uline(),
url_unikn()
# Basics: mark(labels = "This is a test.", new_plot = "blank") # create a new blank plot mark(labels = "More testing here...", y = .45, col_bg = pal_pinky[[2]]) # add to plot # Example: # (a) Mark text on an existing plot: plot(x = 0, y = 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), xlab = "", ylab = "") mark(x = 0, y = .8, labels = "Mark (on an existing plot)") # uses existing plot # (b) Mark text on a new plot: mark(x = 0, y = .8, labels = "Mark (and create a new plot)", new_plot = "slide") # starts a new plot # (c) More text and decorations: mark(x = 0, y = c(.60, .50), labels = c("Highlighting text is simple", "and effective"), cex = 1.5, col_bg = c(pal_seeblau[[2]], pal_seeblau[[1]])) mark(labels = c("It is also flexible", "but to be handled with care"), x = .4, y = .3, y_layout = "flush", cex = 1.2, col = c("white", "black"), col_bg = c(pal_seeblau[[5]], "gold")) # Using x_layout and y_layout: mark(labels = c("One, and", "two, and", "three and four is", "plenty and perhaps enough..."), cex = 1.4, font = 2, col = "white", col_bg = Bordeaux, x = .5, y = .6, x_layout = c(-.25, +.25), y_layout = 0, new_plot = "slide")# Basics: mark(labels = "This is a test.", new_plot = "blank") # create a new blank plot mark(labels = "More testing here...", y = .45, col_bg = pal_pinky[[2]]) # add to plot # Example: # (a) Mark text on an existing plot: plot(x = 0, y = 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), xlab = "", ylab = "") mark(x = 0, y = .8, labels = "Mark (on an existing plot)") # uses existing plot # (b) Mark text on a new plot: mark(x = 0, y = .8, labels = "Mark (and create a new plot)", new_plot = "slide") # starts a new plot # (c) More text and decorations: mark(x = 0, y = c(.60, .50), labels = c("Highlighting text is simple", "and effective"), cex = 1.5, col_bg = c(pal_seeblau[[2]], pal_seeblau[[1]])) mark(labels = c("It is also flexible", "but to be handled with care"), x = .4, y = .3, y_layout = "flush", cex = 1.2, col = c("white", "black"), col_bg = c(pal_seeblau[[5]], "gold")) # Using x_layout and y_layout: mark(labels = c("One, and", "two, and", "three and four is", "plenty and perhaps enough..."), cex = 1.4, font = 2, col = "white", col_bg = Bordeaux, x = .5, y = .6, x_layout = c(-.25, +.25), y_layout = 0, new_plot = "slide")
newpal allows defining new color palettes
(as data frames or vectors).
newpal(col, names = NULL, pattern = NULL, replacement = NULL, as_df = FALSE)newpal(col, names = NULL, pattern = NULL, replacement = NULL, as_df = FALSE)
col |
A required vector of colors (specified as R color names, HEX codes, or RGB values). |
names |
An optional character vector of color names.
Default: |
pattern |
A pattern to be replaced in |
replacement |
A replacement for |
as_df |
Should the new color palette be returned as
a data frame (rather than as a vector)?
Default: |
Specifying pattern and replacment allows modifying names
by regular expressions (using gsub(..., perl = TRUE)).
By default, new palette is returned as a (named) vector.
Setting as_df = TRUE returns new palette as a data frame.
A (named) vector or data frame.
seecol for viewing and comparing color palettes;
usecol for using color palettes;
simcol for finding similar colors;
grepal for finding named colors;
shades_of to defining shades of a given color;
ac for adjusting color transparency;
pal_unikn for the default uni.kn color palette.
Other color functions:
ac(),
demopal(),
grepal(),
plot_cube(),
seecol(),
shades_of(),
simcol(),
usecol()
newpal(col = c("black", "white"), names = c("dark", "bright")) # Example: 3 ways of defining a new color palette: # (1) From R color names: ----- pal_flag_de <- newpal(col = c("black", "firebrick3", "gold"), names = c("Schwarz", "Rot", "Gold")) seecol(pal_flag_de, main = "Colors of the German flag") # (2) From HEX values: ----- # (a) Google logo colors: # Source: https://www.schemecolor.com/google-logo-colors.php color_google <- c("#4285f4", "#34a853", "#fbbc05", "#ea4335") names_google <- c("blueberry", "sea green", "selective yellow", "cinnabar") pal_google <- newpal(color_google, names_google, pattern = "\\s+", replacement = "_") seecol(pal_google, main = "Colors of the Google logo", col_brd = "white", lwd_brd = 10) # (b) German flag (revised): # Based on a different source at # <https://www.schemecolor.com/germany-flag-colors.php>: pal_flag_de_2 <- newpal(col = c("#000000", "#dd0000", "#ffce00"), names = c("black", "red", "gold") ) seecol(pal_flag_de_2, main = "Colors of the German flag (www.schemecolor.com)") # (c) Mixing HEX and R color names: pal_mpg <- newpal(col = c("#007367", "white", "#D0D3D4"), names = c("MPG green", "white", "MPG grey"), pattern = "([A-Z])", replacement = "\\L\\1" # replace upper by lowercase ) seecol(pal_mpg, main = "The colors of the Max Planck Society", col_bg = "grey") # (3) From RGB values: ----- # A barrier-free color palette # Source: Okabe & Ito (2002): Color Universal Design (CUD): # Fig. 16 of <https://jfly.uni-koeln.de/color/>: # (a) Vector of colors (as RGB values): o_i_colors <- c(rgb( 0, 0, 0, maxColorValue = 255), # black rgb(230, 159, 0, maxColorValue = 255), # orange rgb( 86, 180, 233, maxColorValue = 255), # skyblue rgb( 0, 158, 115, maxColorValue = 255), # green rgb(240, 228, 66, maxColorValue = 255), # yellow rgb( 0, 114, 178, maxColorValue = 255), # blue rgb(213, 94, 0, maxColorValue = 255), # vermillion rgb(204, 121, 167, maxColorValue = 255) # purple ) # (b) Vector of color names: o_i_names <- c("black", "orange", "skyblue", "green", "yellow", "blue", "vermillion", "purple") # (c) Use newpal() to combine colors and names: pal_okabe_ito <- newpal(col = o_i_colors, names = o_i_names, pattern = "(^[a-z])", replacement = "\\U\\1") # capitalize initial seecol(pal_okabe_ito, main = "Color-blind friendly color scale (Okabe & Ito, 2002)") # (+) Compare custom color palettes: ----- my_pals <- list(pal_flag_de, pal_flag_de_2, pal_google, pal_mpg, pal_okabe_ito) seecol(my_pals, col_brd = "white", lwd_brd = 4, main = "Comparing custom color palettes")newpal(col = c("black", "white"), names = c("dark", "bright")) # Example: 3 ways of defining a new color palette: # (1) From R color names: ----- pal_flag_de <- newpal(col = c("black", "firebrick3", "gold"), names = c("Schwarz", "Rot", "Gold")) seecol(pal_flag_de, main = "Colors of the German flag") # (2) From HEX values: ----- # (a) Google logo colors: # Source: https://www.schemecolor.com/google-logo-colors.php color_google <- c("#4285f4", "#34a853", "#fbbc05", "#ea4335") names_google <- c("blueberry", "sea green", "selective yellow", "cinnabar") pal_google <- newpal(color_google, names_google, pattern = "\\s+", replacement = "_") seecol(pal_google, main = "Colors of the Google logo", col_brd = "white", lwd_brd = 10) # (b) German flag (revised): # Based on a different source at # <https://www.schemecolor.com/germany-flag-colors.php>: pal_flag_de_2 <- newpal(col = c("#000000", "#dd0000", "#ffce00"), names = c("black", "red", "gold") ) seecol(pal_flag_de_2, main = "Colors of the German flag (www.schemecolor.com)") # (c) Mixing HEX and R color names: pal_mpg <- newpal(col = c("#007367", "white", "#D0D3D4"), names = c("MPG green", "white", "MPG grey"), pattern = "([A-Z])", replacement = "\\L\\1" # replace upper by lowercase ) seecol(pal_mpg, main = "The colors of the Max Planck Society", col_bg = "grey") # (3) From RGB values: ----- # A barrier-free color palette # Source: Okabe & Ito (2002): Color Universal Design (CUD): # Fig. 16 of <https://jfly.uni-koeln.de/color/>: # (a) Vector of colors (as RGB values): o_i_colors <- c(rgb( 0, 0, 0, maxColorValue = 255), # black rgb(230, 159, 0, maxColorValue = 255), # orange rgb( 86, 180, 233, maxColorValue = 255), # skyblue rgb( 0, 158, 115, maxColorValue = 255), # green rgb(240, 228, 66, maxColorValue = 255), # yellow rgb( 0, 114, 178, maxColorValue = 255), # blue rgb(213, 94, 0, maxColorValue = 255), # vermillion rgb(204, 121, 167, maxColorValue = 255) # purple ) # (b) Vector of color names: o_i_names <- c("black", "orange", "skyblue", "green", "yellow", "blue", "vermillion", "purple") # (c) Use newpal() to combine colors and names: pal_okabe_ito <- newpal(col = o_i_colors, names = o_i_names, pattern = "(^[a-z])", replacement = "\\U\\1") # capitalize initial seecol(pal_okabe_ito, main = "Color-blind friendly color scale (Okabe & Ito, 2002)") # (+) Compare custom color palettes: ----- my_pals <- list(pal_flag_de, pal_flag_de_2, pal_google, pal_mpg, pal_okabe_ito) seecol(my_pals, col_brd = "white", lwd_brd = 4, main = "Comparing custom color palettes")
pal_bordeaux provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Bordeaux).
pal_bordeauxpal_bordeaux
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_peach and pal_pinky for alternative redish uni.kn color palettes;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_bordeaux dim(pal_bordeaux) # 1 5 pal_bordeaux[4] # preferred (named) color "bordeaux4" pal_bordeaux[[4]] # preferred color "bordeaux4" OR "#8E2043" # Plotting palette: seecol(pal_bordeaux)pal_bordeaux dim(pal_bordeaux) # 1 5 pal_bordeaux[4] # preferred (named) color "bordeaux4" pal_bordeaux[[4]] # preferred color "bordeaux4" OR "#8E2043" # Plotting palette: seecol(pal_bordeaux)
pal_grau provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Grau or grey).
pal_graupal_grau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_grau dim(pal_grau) # 1 5 pal_grau[3] # preferred (named) color "grau3" pal_grau[[3]] # preferred color "grau3" OR "#9AA0A7" # Plotting palette: seecol(pal_grau)pal_grau dim(pal_grau) # 1 5 pal_grau[3] # preferred (named) color "grau3" pal_grau[[3]] # preferred color "grau3" OR "#9AA0A7" # Plotting palette: seecol(pal_grau)
pal_karpfenblau provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Karpfenblau or blue carp).
pal_karpfenblaupal_karpfenblau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_seeblau for the default seeblau uni.kn color palette;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_karpfenblau dim(pal_karpfenblau) # 1 5 pal_karpfenblau[4] # preferred (named) color "karpfenblau4" pal_karpfenblau[[4]] # preferred color "karpfenblau4" OR "#3E5496" # Plotting palette: seecol(pal_karpfenblau)pal_karpfenblau dim(pal_karpfenblau) # 1 5 pal_karpfenblau[4] # preferred (named) color "karpfenblau4" pal_karpfenblau[[4]] # preferred color "karpfenblau4" OR "#3E5496" # Plotting palette: seecol(pal_karpfenblau)
pal_peach provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Peach).
pal_peachpal_peach
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_pinky and pal_bordeaux for alternative redish uni.kn color palettes;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_peach dim(pal_peach) # 1 5 pal_peach[4] # preferred (named) color "peach4" pal_peach[[4]] # preferred color "peach4" OR "#FEA090" # Plotting palette: seecol(pal_peach)pal_peach dim(pal_peach) # 1 5 pal_peach[4] # preferred (named) color "peach4" pal_peach[[4]] # preferred color "peach4" OR "#FEA090" # Plotting palette: seecol(pal_peach)
pal_petrol provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Petrol or grue).
pal_petrolpal_petrol
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details, and https://en.wikipedia.org/wiki/New_riddle_of_induction for the portmanteau "grue".
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_seegruen for an alternative green/grue uni.kn color palette;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_petrol dim(pal_petrol) # 1 5 pal_petrol[4] # preferred (named) color "petrol4" pal_petrol[[4]] # preferred color "petrol4" OR "#077187" # Plotting palette: seecol(pal_petrol)pal_petrol dim(pal_petrol) # 1 5 pal_petrol[4] # preferred (named) color "petrol4" pal_petrol[[4]] # preferred color "petrol4" OR "#077187" # Plotting palette: seecol(pal_petrol)
pal_pinky provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Pinky or pink).
pal_pinkypal_pinky
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_peach and pal_bordeaux for alternative redish uni.kn color palettes;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_pinky dim(pal_pinky) # 1 5 pal_pinky[4] # preferred (named) color "pinky4" pal_pinky[[4]] # preferred color "pinky4" OR "#E0607E" # Plotting palette: seecol(pal_pinky)pal_pinky dim(pal_pinky) # 1 5 pal_pinky[4] # preferred (named) color "pinky4" pal_pinky[[4]] # preferred color "pinky4" OR "#E0607E" # Plotting palette: seecol(pal_pinky)
pal_seeblau provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Seeblau).
pal_seeblaupal_seeblau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_karpfenblau for an alternative blue uni.kn color palette;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_seeblau dim(pal_seeblau) # 1 5 # Preferred color: pal_seeblau[3] # preferred (named) color "seeblau3" (as df) pal_seeblau[[3]] # preferred color value "#59C7EB" # Access by position: pal_seeblau[3] # named color "seeblau3" (as df) pal_seeblau[[3]] # color value "#59C7EB" # Access by name: pal_unikn["seeblau3"] # color "seeblau3" (as df) pal_unikn[["seeblau3"]] # color value "#59C7EB" # Plotting palette: seecol(pal_seeblau)pal_seeblau dim(pal_seeblau) # 1 5 # Preferred color: pal_seeblau[3] # preferred (named) color "seeblau3" (as df) pal_seeblau[[3]] # preferred color value "#59C7EB" # Access by position: pal_seeblau[3] # named color "seeblau3" (as df) pal_seeblau[[3]] # color value "#59C7EB" # Access by name: pal_unikn["seeblau3"] # color "seeblau3" (as df) pal_unikn[["seeblau3"]] # color value "#59C7EB" # Plotting palette: seecol(pal_seeblau)
pal_seegruen provides an additional uni.kn color palette
as a data frame containing 5 colors (shades of
Seegruen).
pal_seegruenpal_seegruen
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_petrol for an alternative green uni.kn color palette;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_seegruen dim(pal_seegruen) # 1 5 pal_seegruen[4] # preferred (named) color "seegruen4" pal_seegruen[[4]] # preferred color "seegruen4" OR "#0A9086" # Plotting palette: seecol(pal_seegruen)pal_seegruen dim(pal_seegruen) # 1 5 pal_seegruen[4] # preferred (named) color "seegruen4" pal_seegruen[[4]] # preferred color "seegruen4" OR "#0A9086" # Plotting palette: seecol(pal_seegruen)
pal_signal provides an additional uni.kn color palette
as a data frame containing 3 colors (Ampel or traffic signal colors).
pal_signalpal_signal
The colors are arranged as in a traffic light ("Ampel"):
top: red or "bad"
mid: yellow or "alert"
bot: green or "good"
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_signal dim(pal_signal) # 1 3 pal_signal[2] # (named) color "signal2" pal_signal[[2]] # color "signal2" OR "#EFDC60" # Plotting palette: seecol(pal_signal)pal_signal dim(pal_signal) # 1 3 pal_signal[2] # (named) color "signal2" pal_signal[[2]] # color "signal2" OR "#EFDC60" # Plotting palette: seecol(pal_signal)
pal_unikn combines the 5 shades of blue colors
from color palette pal_seeblau
with the 6 non-blue colors of pal_unikn_web
to a divergent palette of 11 colors.
pal_uniknpal_unikn
Adding seeblau5 (i.e., pal_seeblau[1]) to
the default color palette pal_unikn
also puts white at the central (middle)
position of a color palette with 11 values:
pal_unikn[[6]] is white or "#FFFFFF".
A divergent palette is useful for creating color gradients.
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the default uni.kn color palette;
pal_seeblau for the uni.kn seeblau color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_unikn dim(pal_unikn) # 1 11 # Access by position: pal_unikn[1] # new color "seeblau5" (as df) pal_unikn[[1]] # new color value "#008ECE" # Access by name: pal_unikn["seeblau5"] # new color "seeblau5" (as df) pal_unikn[["seeblau5"]] # new color value "#008ECE" # Viewing/using color palette: seecol(pal_unikn) demopal(pal_unikn, type = "curve", main = "Default colors of Konstanz University") # Note: pal_unikn[6] # "white" or "#FFFFFF" as central of 11 colorspal_unikn dim(pal_unikn) # 1 11 # Access by position: pal_unikn[1] # new color "seeblau5" (as df) pal_unikn[[1]] # new color value "#008ECE" # Access by name: pal_unikn["seeblau5"] # new color "seeblau5" (as df) pal_unikn[["seeblau5"]] # new color value "#008ECE" # Viewing/using color palette: seecol(pal_unikn) demopal(pal_unikn, type = "curve", main = "Default colors of Konstanz University") # Note: pal_unikn[6] # "white" or "#FFFFFF" as central of 11 colors
pal_unikn_dark provides an additional uni.kn color palette
that collects 2 dark colors of 5 color palettes
as a data frame containing 10 colors (in 5 pairs).
pal_unikn_darkpal_unikn_dark
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn_light for a lighter uni.kn color palette;
pal_unikn_pair for a pairwise uni.kn color palette;
pal_unikn for the default uni.kn color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_unikn_dark dim(pal_unikn_dark) # 1 8 pal_unikn_dark[1] # color "karpfenblau5" by position pal_unikn_dark[[1]] # color value by position: #324376" pal_unikn_dark["karpfenblau5"] # color value by name # Viewing/using color palette: seecol(pal_unikn_dark) demopal(pal_unikn_dark, type = "points", main = "Dark colors of Konstanz University")pal_unikn_dark dim(pal_unikn_dark) # 1 8 pal_unikn_dark[1] # color "karpfenblau5" by position pal_unikn_dark[[1]] # color value by position: #324376" pal_unikn_dark["karpfenblau5"] # color value by name # Viewing/using color palette: seecol(pal_unikn_dark) demopal(pal_unikn_dark, type = "points", main = "Dark colors of Konstanz University")
pal_unikn_light provides an additional uni.kn color palette
that collects 2 light colors of 5 color palettes
as a data frame containing 10 colors (in 5 pairs).
pal_unikn_lightpal_unikn_light
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn_dark for a darker uni.kn color palette;
pal_unikn_pair for a pairwise uni.kn color palette;
pal_unikn for the default uni.kn color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_unikn_light dim(pal_unikn_light) # 1 10 # Access by position: pal_unikn_light[1] # color "seeblau3" (as df) pal_unikn_light[[1]] # color value "#59C7EB" # Access by name: pal_unikn_light["seeblau3"] # color "seeblau3" (as df) pal_unikn_light[["seeblau3"]] # color value "#59C7EB" # Viewing/using color palette: seecol(pal_unikn_light) demopal(pal_unikn_light, type = "bar", main = "Light colors of Konstanz University")pal_unikn_light dim(pal_unikn_light) # 1 10 # Access by position: pal_unikn_light[1] # color "seeblau3" (as df) pal_unikn_light[[1]] # color value "#59C7EB" # Access by name: pal_unikn_light["seeblau3"] # color "seeblau3" (as df) pal_unikn_light[["seeblau3"]] # color value "#59C7EB" # Viewing/using color palette: seecol(pal_unikn_light) demopal(pal_unikn_light, type = "bar", main = "Light colors of Konstanz University")
pal_unikn_pair provides an additional uni.kn color palette
that collects 16 paired colors of 8 color palettes
as a data frame containing 16 colors (in 8 pairs).
pal_unikn_pairpal_unikn_pair
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn_light for a lighter uni.kn color palette;
pal_unikn_dark for a darker uni.kn color palette;
pal_unikn for the default uni.kn color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_ppt,
pal_unikn_pref,
pal_unikn_web
pal_unikn_pair dim(pal_unikn_pair) # 1 16 pal_unikn_pair[1] # color "karpfenblau4" by position pal_unikn_pair[[1]] # color value by position: #3E5496" pal_unikn_pair["karpfenblau4"] # color value by name # Viewing/using color palette: seecol(pal_unikn_pair) demopal(pal_unikn_pair, type = "polygon", main = "A pair-wise color palette")pal_unikn_pair dim(pal_unikn_pair) # 1 16 pal_unikn_pair[1] # color "karpfenblau4" by position pal_unikn_pair[[1]] # color value by position: #3E5496" pal_unikn_pair["karpfenblau4"] # color value by name # Viewing/using color palette: seecol(pal_unikn_pair) demopal(pal_unikn_pair, type = "polygon", main = "A pair-wise color palette")
pal_unikn_ppt provides an alternative uni.kn color palette
as a data frame containing 10 colors.
pal_unikn_pptpal_unikn_ppt
This is a secondary (ppt) variant with more muted colors.
See pal_unikn for the primary/default (web/sRGB) scale
and https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_pref,
pal_unikn_web
pal_unikn_ppt dim(pal_unikn_ppt) # 1 10 # Access by position: pal_unikn_ppt[2] # 2nd named color "seeblau3" (as df) pal_unikn_ppt[[2]] # 2nd color value "#59B6DC" # Access by name: pal_unikn_ppt["seeblau3"] # color "seeblau3" (as df) pal_unikn_ppt[["seeblau3"]] # color value "#59B6DC" # Plotting palette: seecol(pal_unikn_ppt)pal_unikn_ppt dim(pal_unikn_ppt) # 1 10 # Access by position: pal_unikn_ppt[2] # 2nd named color "seeblau3" (as df) pal_unikn_ppt[[2]] # 2nd color value "#59B6DC" # Access by name: pal_unikn_ppt["seeblau3"] # color "seeblau3" (as df) pal_unikn_ppt[["seeblau3"]] # color value "#59B6DC" # Plotting palette: seecol(pal_unikn_ppt)
pal_unikn_pref provides an additional uni.kn color palette
that collects the preferred color of each palette
as a data frame containing 9 (or 8 + 1) colors.
pal_unikn_prefpal_unikn_pref
The colors are arranged in a sequence that provides high contrasts between adjacent colors.
Note that the (alert) color Signal is
not a preferred color according to the official color
definition.
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the default uni.kn color palette;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_web
pal_unikn_pref dim(pal_unikn_pref) # 1 9 # Access by position: pal_unikn_pref[1] # color Seeblau (as df) pal_unikn_pref[[1]] # color value "#59C7EB" # Access by name: pal_unikn_pref["Seeblau"] # color "seeblau3" (as df) pal_unikn_pref[["Seeblau"]] # color value "#59C7EB" # Viewing/using color palette: seecol(pal_unikn_pref) demopal(pal_unikn_pref, type = "mosaic", main = "Preferred colors of Konstanz University")pal_unikn_pref dim(pal_unikn_pref) # 1 9 # Access by position: pal_unikn_pref[1] # color Seeblau (as df) pal_unikn_pref[[1]] # color value "#59C7EB" # Access by name: pal_unikn_pref["Seeblau"] # color "seeblau3" (as df) pal_unikn_pref[["Seeblau"]] # color value "#59C7EB" # Viewing/using color palette: seecol(pal_unikn_pref) demopal(pal_unikn_pref, type = "mosaic", main = "Preferred colors of Konstanz University")
pal_unikn_web provides the default uni.kn color palette
as a data frame containing 10 colors.
pal_unikn_webpal_unikn_web
This is the primary (web/sRGB) scale.
Note that pal_unikn provides a divergent color palette (of 11 colors).
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_ppt for an alternative (ppt) version;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other color palettes:
pal_bordeaux,
pal_grau,
pal_karpfenblau,
pal_peach,
pal_petrol,
pal_pinky,
pal_seeblau,
pal_seegruen,
pal_signal,
pal_unikn,
pal_unikn_dark,
pal_unikn_light,
pal_unikn_pair,
pal_unikn_ppt,
pal_unikn_pref
pal_unikn_web dim(pal_unikn_web) # 1 10 # Access by position: pal_unikn_web[2] # 2nd named color "seeblau3" (as df) pal_unikn_web[[2]] # 2nd color value "#59C7EB" # Access by name: pal_unikn_web["seeblau3"] # color "seeblau3" (as df) pal_unikn_web[["seeblau3"]] # color value "#59C7EB" # Plotting palette: seecol(pal_unikn_web)pal_unikn_web dim(pal_unikn_web) # 1 10 # Access by position: pal_unikn_web[2] # 2nd named color "seeblau3" (as df) pal_unikn_web[[2]] # 2nd color value "#59C7EB" # Access by name: pal_unikn_web["seeblau3"] # color "seeblau3" (as df) pal_unikn_web[["seeblau3"]] # color value "#59C7EB" # Plotting palette: seecol(pal_unikn_web)
Peach provides the preferred color of pal_peach
(as an atomic HEX character value) and is defined as
pal_peach[[4]].
PeachPeach
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_peach for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Petrol,
Pinky,
Seeblau,
Seegruen,
Signal
Peach # HEX character "#FEA090" (as value) all.equal(Peach, pal_peach[[4]]) # TRUE (same HEX values) seecol(Peach) # view color and detailsPeach # HEX character "#FEA090" (as value) all.equal(Peach, pal_peach[[4]]) # TRUE (same HEX values) seecol(Peach) # view color and details
Petrol provides the preferred color of pal_petrol
(as an atomic HEX character value) and is defined as
pal_petrol[[4]].
PetrolPetrol
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_petrol for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Peach,
Pinky,
Seeblau,
Seegruen,
Signal
Petrol # HEX character "#077187" (as value) all.equal(Petrol, pal_petrol[[4]]) # TRUE (same HEX values) seecol(Petrol) # view color and detailsPetrol # HEX character "#077187" (as value) all.equal(Petrol, pal_petrol[[4]]) # TRUE (same HEX values) seecol(Petrol) # view color and details
Pinky provides the preferred color of pal_pinky
(as an atomic HEX character value) and is defined as
pal_pinky[[4]].
PinkyPinky
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_pinky for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Peach,
Petrol,
Seeblau,
Seegruen,
Signal
Pinky # HEX character "#E0607E" (as value) all.equal(Pinky, pal_pinky[[4]]) # TRUE (same HEX values) seecol(Pinky) # view color and detailsPinky # HEX character "#E0607E" (as value) all.equal(Pinky, pal_pinky[[4]]) # TRUE (same HEX values) seecol(Pinky) # view color and details
plot_cube plots one or more colors x
as points in a 3-dimensional cube whose axes correspond
to the red, green, and blue values of the RGB color model
(ranging from 0 to 255).
plot_cube( x, type = "p", col_points = NA, cex_points = 2, pch = 21, col_brd = grey(0.25, 1), n_boxes = 20, shade = FALSE, ref_lines = FALSE, col_line = NA, lwd_line = 3, line_connect = "path", col_fill = NA, lwd_outline = 1, fill_alpha = 0.75, fill_res = 20, shadows = "none", col_shadow = grey(0.7, 0.9), show_corners = TRUE, col_cube = grey(0.5, 1), grid = FALSE, grid_faces = FALSE, grid_inner = FALSE, grid_at = 2, col_grid = grey(0.6, 0.6), col_grid_inner = grey(0.8, 0.5), axis_labels = c("R", "G", "B"), axis_ticks = TRUE, n_ticks = 5, cex_axis = NA, labels = "names", theta = -30, phi = 15, main = "Colors in 3D RGB space", cex_lbl = 0.85, ... )plot_cube( x, type = "p", col_points = NA, cex_points = 2, pch = 21, col_brd = grey(0.25, 1), n_boxes = 20, shade = FALSE, ref_lines = FALSE, col_line = NA, lwd_line = 3, line_connect = "path", col_fill = NA, lwd_outline = 1, fill_alpha = 0.75, fill_res = 20, shadows = "none", col_shadow = grey(0.7, 0.9), show_corners = TRUE, col_cube = grey(0.5, 1), grid = FALSE, grid_faces = FALSE, grid_inner = FALSE, grid_at = 2, col_grid = grey(0.6, 0.6), col_grid_inner = grey(0.8, 0.5), axis_labels = c("R", "G", "B"), axis_ticks = TRUE, n_ticks = 5, cex_axis = NA, labels = "names", theta = -30, phi = 15, main = "Colors in 3D RGB space", cex_lbl = 0.85, ... )
x |
A (character) vector of colors to be plotted,
specified as R color names (e.g., Alternatively,
For example, |
type |
Type of geometric element to draw from the colors
By default, connecting lines and plane fills are shown as color gradients
(i.e., each location is shown in the color of the corresponding RGB mixture),
to illustrate the additive mixing of colors in RGB space.
In all cases, only the colors |
col_points |
Color(s) used for the plotted points.
Default: |
cex_points |
Scaling factor for the size of points.
Default: |
pch |
Plotting symbol for points (see |
col_brd |
Border color of points
(for fillable symbols, i.e., |
n_boxes |
Number of boxes per axis (for Note: Boxes are axis-aligned (their edges run parallel to the RGB axes).
Under the default perspective projection of |
shade |
Boolean: Shade the faces of each box (for |
ref_lines |
Boolean: Draw a vertical reference line
from each point down to the floor (R-by-G base plane) of the cube
(to ease judging a point's height on the B/blue axis)?
Default: |
col_line |
Color of connecting lines (for |
lwd_line |
Line width of connecting lines
(for |
line_connect |
How to connect 3 or more colors by lines
(for
For 2 colors, all 3 options yield the same single line.
(The value |
col_fill |
Fill color for the plane (for |
lwd_outline |
Line width of plane outlines
(for |
fill_alpha |
Opacity of the plane fill (in range |
fill_res |
Resolution of color gradients
(i.e., the number of line segments per connection, and the
granularity of the plane tessellation).
Higher values yield smoother gradients (but slower plotting).
Default: |
shadows |
Project each point onto one or more faces of the cube (as "shadow" points, to aid judging its 3D location). Options (one or more of which may be combined) are:
Each shadow is a smaller marker on the corresponding face, linked to
its point by a dotted connector. As a projection drops one color channel,
a shadow also shows the color with that primary removed.
Default: |
col_shadow |
Color of the shadow markers.
Default: Setting |
show_corners |
Boolean option to mark the 8 corners of the cube
by points in their corresponding colors
(i.e., black, white, and the 6 primary/secondary colors RGB/CMY).
Default: |
col_cube |
Color for the edges and axes of the cube.
Default: |
grid |
Boolean convenience switch to
enable a default reference-grid combination
(akin to the |
grid_faces |
Draw reference grid lines on the cube's faces, to ease judging a point's 3D location. Options are:
Line positions are set by |
grid_inner |
Boolean to draw reference grid lines across the cube's
volume (interior lines connecting opposite faces: front-to-back,
top-to-bottom, and left-to-right), as a 3D orientation aid.
Line positions are set by |
grid_at |
Positioning of the grid lines (for
(The endpoints 0 and 255 are always omitted, as they are the cube's edges.)
Default: |
col_grid |
Color of the face grid lines ( |
col_grid_inner |
Color of the inner (volume) grid lines ( |
axis_labels |
Titles for the 3 cube axes (R, G, and B). Options are:
Default: |
axis_ticks |
Draw tick marks and numeric value labels (in range 0 to 255)
along the 3 cube axes? Either a Boolean value, or a numeric vector
specifying custom tick positions (in |
n_ticks |
Number of (equally spaced) ticks per axis
(only used when |
cex_axis |
Scaling factor for axis titles and tick values.
Default: |
labels |
Type(s) of labels for the points. One or more of the following label types may be specified (and are shown on separate lines when combined):
Thus, |
theta |
Horizontal rotation angle (azimuth, used by |
phi |
Vertical rotation angle (colatitude, used by |
main |
Main plot title.
Default: |
cex_lbl |
Scaling factor for text labels (axes, titles, point labels).
Default: |
... |
Other (graphical) parameters passed to |
Each color is converted into its RGB coordinates
(via col2rgb) and shown as a point
at the corresponding location in the color cube.
Points are filled with the color they represent, so that
the location of a point in the cube illustrates the
additive composition of its color from the three
primary colors (Red, Green, and Blue).
plot_cube uses base graphics
(i.e., persp and trans3d)
and requires no additional package dependencies.
A projection matrix (of class returned by persp)
that maps 3D coordinates to the 2D plotting plane (returned invisibly).
seecol for viewing and comparing color palettes;
usecol for using color palettes;
newpal for defining new color palettes;
col2rgb for converting colors to RGB values.
Other color functions:
ac(),
demopal(),
grepal(),
newpal(),
seecol(),
shades_of(),
simcol(),
usecol()
# A. Basics: ------ plot_cube("tomato") # a single color plot_cube(c("red", "green", "blue")) # primary RGB colors plot_cube(c("black", "grey50", "white")) # grey diagonal # Using unikn colors: plot_cube(pal_unikn) # a bi-polar color palette plot_cube(pal_unikn_pref) # a categorical color palette # Reduced color options: col_mix <- c("grey50", "deepskyblue", "forestgreen", "gold", "orchid", "tomato") plot_cube(col_mix, show_corners = FALSE) # hide corner colors plot_cube(pal_unikn, col_points = "black") # all points in 1 color # Labeling points (by names, RGB or HEX values, or combinations): col_4 <- c("red3", "green4", "gold", "violet") plot_cube(col_4) # names (default) plot_cube(col_4, labels = "hex") # HEX values plot_cube(col_4, labels = "rgb") # RGB values plot_cube(col_4, labels = c("names", "hex", "rgb")) # all 3 types plot_cube(col_4, labels = "no") # no labels # Connecting points by lines (type = "l" or "b"): plot_cube(c("grey", "white"), type = "l") # line (grey diagonal) plot_cube(c("red", "blue"), type = "b") # line with points (red-blue gradient) # Changing the viewing angle: plot_cube(pal_unikn, theta = 30, phi = 25) # With >2 colors: All pairs, disjoint pairs, or a connecting path (default): plot_cube(col_4, type = "l", line_connect = "all") # all pairs plot_cube(col_4, type = "b", line_connect = "pairs") # disjoint pairs (and points) plot_cube(pal_unikn, type = "b", line_connect = "path") # connecting path (in palette order) # Using line_connect = "pairs" to link disjoint color pairs, e.g., to show # the 3 complementary RGB/CMY pairs (each line crosses the grey cube center): plot_cube(c("red", "cyan", "green", "magenta", "blue", "yellow"), type = "b", line_connect = "pairs", grid = TRUE, main = "Complementary colors") # Spanning a plane through 3 colors (type = "plane"): plot_cube(c("red", "green", "blue"), type = "plane") # gamut of 3 primary RGB colors plot_cube(c("cyan", "yellow", "magenta"), # gamut of 3 opposite RGB colors type = "plane", labels = c("names", "rgb")) # Colors as 3D boxes (type = "box"): Box faces show each color's RGB value plot_cube(c("cyan3", "gold", "grey80", "grey20", "skyblue", "tomato"), type = "box") # point boxes plot_cube(pal_unikn, type = "box", grid = TRUE) # a palette as boxes # plot_cube(pal_unikn, type = "box", n_boxes = 10) # fewer, larger boxes # plot_cube(pal_unikn, type = "box", shade = TRUE) # shaded faces (subtle 3D effect) # plot_cube(pal_unikn, type = "box", d = 10) # near-orthographic (edges parallel) # Grouped colors: Passing a list combines colors (by group size): # Each c() group becomes a point (1 color), line (2), or plane (3+): plot_cube(list(Seeblau, c(Pinky, Seegruen), # 1 point, 1 line, and c("red", "green", "blue"))) # 1 plane # A lone point, a line, and a plane (with the defining points marked): plot_cube(list("gold", # unlinked point c("black", "white"), # b/w diagonal (line) c("cyan", "magenta", "yellow"))) # CMY gamut (plane) # Two separate lines (e.g., 2 complementary RGB/CMY pairs): plot_cube(list(c("red", "cyan"), c("green", "magenta")), lwd_line = 5, grid = TRUE) # Groups may themselves be palettes (data frames are flattened per group): plot_cube(list(pal_seeblau, pal_pinky)) # 2 palette planes # Shadow points (projections onto cube faces): plot_cube(c("tomato", "deepskyblue"), shadows = "floor") # on the floor (B = 0) plot_cube(pal_seeblau, shadows = "all") # on all 3 faces plot_cube(c("grey20", "grey50", "grey80"), # show shadows in projected colors shadows = "all", col_shadow = NA) # Axis options (titles and value ticks): plot_cube(pal_unikn, axis_labels = "long") # long axis titles plot_cube(pal_unikn, n_ticks = 11) # finer axis scale (0, 25.5, ...) plot_cube(pal_unikn, axis_ticks = c(0, 128, 255)) # custom tick positions plot_cube(pal_unikn, axis_ticks = FALSE) # no ticks (titles only) plot_cube(pal_unikn, axis_labels = "no", axis_ticks = FALSE) # bare cube # Grid options (to aid judging 3D locations): # Both reference grids improve orientation, but only when used sparsely. # a. Default of grid = TRUE (splits cube into octants): col_mix <- c("grey50", "deepskyblue", "forestgreen", "gold", "orchid", "tomato") plot_cube(col_mix, grid = TRUE) # b. Both grids at thirds (more structure, but quickly gets dense): plot_cube(col_mix, grid = TRUE, grid_at = 3) # c. Both grids at rare axis ticks (to align grid with tick labels): plot_cube(col_mix, grid = TRUE, grid_at = "ticks", n_ticks = 4) # d. Face grid only (often suffices, as inner grid may not be needed): plot_cube(pal_unikn, grid_faces = "base", n_ticks = 5, grid_at = "ticks") # B. Basic demonstrations of the 3D color cube (RGB/CMY): ------ # 1. The 8 color corners of the RGB cube (b/w + RGB + CMY): col_8 <- c("black", "white", "red", "cyan", "blue", "yellow", "green", "magenta") plot_cube(col_8, theta = -30, phi = 30, labels = c("names", "rgb", "hex"), main = "The 6 corners of the RGB cube") # 2. The main black-grey-white diagonal of the cube (with all shades of grey): greys <- paste("grey", seq(0, 100, length.out = 5)) # 5 shades of grey (black to white) plot_cube(greys, type = "b", line_connect = "path", lwd_line = 5, labels = c("names", "hex", "rgb"), phi = 20, theta = -30, main = "5 shades of grey (on b/w diagonal)") # 3. Complementarity of the RGB and CMY color systems: # Each CMY secondary (cyan, magenta, yellow) is the complement of an RGB # primary (red, green, blue): It occupies the opposite corner of the cube, # and a color and its complement mix to grey (at the cube's center). # Show 6 color corners (RGB vs. CMY): col_6 <- c("red", "cyan", "blue", "yellow", "green", "magenta") plot_cube(col_6, labels = c("names", "rgb"), main = "RGB vs CMY: 6 complementary corners of the cube") # Show all 4 cube diagonals: plot_cube(col_8, type = "b", line_connect = "pairs", lwd_line = 5, grid = TRUE, phi = 30, theta = 0, main = "The 4 main diagonals") # Show 2 triangular planes: plot_cube(c("red", "blue", "green"), type = "plane", main = "The RGB plane") plot_cube(c("cyan", "yellow", "magenta"), type = "plane", main = "The CYK plane") # C. Illustrating colors and color palettes (unikn): ------ # 0. Collect main unikn colors (as a vector): col_4 <- c(Seeblau, Pinky, Seegruen, Bordeaux) col_8 <- c(col_4, Petrol, Karpfenblau, Peach, Grau) # 1. Main unikn colors as (labeled) points: plot_cube(col_8, grid = TRUE, main = "The main unikn colors in RGB space") # 2. The default unikn palette (black - Seeblau shades - white) as a path: plot_cube(pal_unikn, type = "b", line_connect = "path", lwd_line = 4, main = "A bi-polar palette (pal_unikn)") plot_cube(pal_unikn_pref, type = "b", line_connect = "path", lwd_line = 4, main = "A categorical color palette (pal_unikn_pref)") # 2. A color palette's shade ramp as a connecting path: plot_cube(pal_pinky, type = "b", line_connect = "path", lwd_line = 5, theta = -40, phi = 20, shadows = "all", main = "The path of pal_pinky") plot_cube(usecol(c(rev(pal_seegruen), "white", pal_bordeaux)), type = "b", line_connect = "path", lwd_line = 5, main = "A custom color gradient") # 4. Pairwise relations among main colors: plot_cube(col_4, type = "plane", shadows = "floor", theta = 0, phi = 0, main = "Pairwise relations of 4 key colors") # 5. The gamut (plane) of mixtures spanned by 3 main colors: plot_cube(c(Seeblau, Pinky, Seegruen), type = "plane", theta = 10, phi = 20, main = "Gamut of 3 key colors")# A. Basics: ------ plot_cube("tomato") # a single color plot_cube(c("red", "green", "blue")) # primary RGB colors plot_cube(c("black", "grey50", "white")) # grey diagonal # Using unikn colors: plot_cube(pal_unikn) # a bi-polar color palette plot_cube(pal_unikn_pref) # a categorical color palette # Reduced color options: col_mix <- c("grey50", "deepskyblue", "forestgreen", "gold", "orchid", "tomato") plot_cube(col_mix, show_corners = FALSE) # hide corner colors plot_cube(pal_unikn, col_points = "black") # all points in 1 color # Labeling points (by names, RGB or HEX values, or combinations): col_4 <- c("red3", "green4", "gold", "violet") plot_cube(col_4) # names (default) plot_cube(col_4, labels = "hex") # HEX values plot_cube(col_4, labels = "rgb") # RGB values plot_cube(col_4, labels = c("names", "hex", "rgb")) # all 3 types plot_cube(col_4, labels = "no") # no labels # Connecting points by lines (type = "l" or "b"): plot_cube(c("grey", "white"), type = "l") # line (grey diagonal) plot_cube(c("red", "blue"), type = "b") # line with points (red-blue gradient) # Changing the viewing angle: plot_cube(pal_unikn, theta = 30, phi = 25) # With >2 colors: All pairs, disjoint pairs, or a connecting path (default): plot_cube(col_4, type = "l", line_connect = "all") # all pairs plot_cube(col_4, type = "b", line_connect = "pairs") # disjoint pairs (and points) plot_cube(pal_unikn, type = "b", line_connect = "path") # connecting path (in palette order) # Using line_connect = "pairs" to link disjoint color pairs, e.g., to show # the 3 complementary RGB/CMY pairs (each line crosses the grey cube center): plot_cube(c("red", "cyan", "green", "magenta", "blue", "yellow"), type = "b", line_connect = "pairs", grid = TRUE, main = "Complementary colors") # Spanning a plane through 3 colors (type = "plane"): plot_cube(c("red", "green", "blue"), type = "plane") # gamut of 3 primary RGB colors plot_cube(c("cyan", "yellow", "magenta"), # gamut of 3 opposite RGB colors type = "plane", labels = c("names", "rgb")) # Colors as 3D boxes (type = "box"): Box faces show each color's RGB value plot_cube(c("cyan3", "gold", "grey80", "grey20", "skyblue", "tomato"), type = "box") # point boxes plot_cube(pal_unikn, type = "box", grid = TRUE) # a palette as boxes # plot_cube(pal_unikn, type = "box", n_boxes = 10) # fewer, larger boxes # plot_cube(pal_unikn, type = "box", shade = TRUE) # shaded faces (subtle 3D effect) # plot_cube(pal_unikn, type = "box", d = 10) # near-orthographic (edges parallel) # Grouped colors: Passing a list combines colors (by group size): # Each c() group becomes a point (1 color), line (2), or plane (3+): plot_cube(list(Seeblau, c(Pinky, Seegruen), # 1 point, 1 line, and c("red", "green", "blue"))) # 1 plane # A lone point, a line, and a plane (with the defining points marked): plot_cube(list("gold", # unlinked point c("black", "white"), # b/w diagonal (line) c("cyan", "magenta", "yellow"))) # CMY gamut (plane) # Two separate lines (e.g., 2 complementary RGB/CMY pairs): plot_cube(list(c("red", "cyan"), c("green", "magenta")), lwd_line = 5, grid = TRUE) # Groups may themselves be palettes (data frames are flattened per group): plot_cube(list(pal_seeblau, pal_pinky)) # 2 palette planes # Shadow points (projections onto cube faces): plot_cube(c("tomato", "deepskyblue"), shadows = "floor") # on the floor (B = 0) plot_cube(pal_seeblau, shadows = "all") # on all 3 faces plot_cube(c("grey20", "grey50", "grey80"), # show shadows in projected colors shadows = "all", col_shadow = NA) # Axis options (titles and value ticks): plot_cube(pal_unikn, axis_labels = "long") # long axis titles plot_cube(pal_unikn, n_ticks = 11) # finer axis scale (0, 25.5, ...) plot_cube(pal_unikn, axis_ticks = c(0, 128, 255)) # custom tick positions plot_cube(pal_unikn, axis_ticks = FALSE) # no ticks (titles only) plot_cube(pal_unikn, axis_labels = "no", axis_ticks = FALSE) # bare cube # Grid options (to aid judging 3D locations): # Both reference grids improve orientation, but only when used sparsely. # a. Default of grid = TRUE (splits cube into octants): col_mix <- c("grey50", "deepskyblue", "forestgreen", "gold", "orchid", "tomato") plot_cube(col_mix, grid = TRUE) # b. Both grids at thirds (more structure, but quickly gets dense): plot_cube(col_mix, grid = TRUE, grid_at = 3) # c. Both grids at rare axis ticks (to align grid with tick labels): plot_cube(col_mix, grid = TRUE, grid_at = "ticks", n_ticks = 4) # d. Face grid only (often suffices, as inner grid may not be needed): plot_cube(pal_unikn, grid_faces = "base", n_ticks = 5, grid_at = "ticks") # B. Basic demonstrations of the 3D color cube (RGB/CMY): ------ # 1. The 8 color corners of the RGB cube (b/w + RGB + CMY): col_8 <- c("black", "white", "red", "cyan", "blue", "yellow", "green", "magenta") plot_cube(col_8, theta = -30, phi = 30, labels = c("names", "rgb", "hex"), main = "The 6 corners of the RGB cube") # 2. The main black-grey-white diagonal of the cube (with all shades of grey): greys <- paste("grey", seq(0, 100, length.out = 5)) # 5 shades of grey (black to white) plot_cube(greys, type = "b", line_connect = "path", lwd_line = 5, labels = c("names", "hex", "rgb"), phi = 20, theta = -30, main = "5 shades of grey (on b/w diagonal)") # 3. Complementarity of the RGB and CMY color systems: # Each CMY secondary (cyan, magenta, yellow) is the complement of an RGB # primary (red, green, blue): It occupies the opposite corner of the cube, # and a color and its complement mix to grey (at the cube's center). # Show 6 color corners (RGB vs. CMY): col_6 <- c("red", "cyan", "blue", "yellow", "green", "magenta") plot_cube(col_6, labels = c("names", "rgb"), main = "RGB vs CMY: 6 complementary corners of the cube") # Show all 4 cube diagonals: plot_cube(col_8, type = "b", line_connect = "pairs", lwd_line = 5, grid = TRUE, phi = 30, theta = 0, main = "The 4 main diagonals") # Show 2 triangular planes: plot_cube(c("red", "blue", "green"), type = "plane", main = "The RGB plane") plot_cube(c("cyan", "yellow", "magenta"), type = "plane", main = "The CYK plane") # C. Illustrating colors and color palettes (unikn): ------ # 0. Collect main unikn colors (as a vector): col_4 <- c(Seeblau, Pinky, Seegruen, Bordeaux) col_8 <- c(col_4, Petrol, Karpfenblau, Peach, Grau) # 1. Main unikn colors as (labeled) points: plot_cube(col_8, grid = TRUE, main = "The main unikn colors in RGB space") # 2. The default unikn palette (black - Seeblau shades - white) as a path: plot_cube(pal_unikn, type = "b", line_connect = "path", lwd_line = 4, main = "A bi-polar palette (pal_unikn)") plot_cube(pal_unikn_pref, type = "b", line_connect = "path", lwd_line = 4, main = "A categorical color palette (pal_unikn_pref)") # 2. A color palette's shade ramp as a connecting path: plot_cube(pal_pinky, type = "b", line_connect = "path", lwd_line = 5, theta = -40, phi = 20, shadows = "all", main = "The path of pal_pinky") plot_cube(usecol(c(rev(pal_seegruen), "white", pal_bordeaux)), type = "b", line_connect = "path", lwd_line = 5, main = "A custom color gradient") # 4. Pairwise relations among main colors: plot_cube(col_4, type = "plane", shadows = "floor", theta = 0, phi = 0, main = "Pairwise relations of 4 key colors") # 5. The gamut (plane) of mixtures spanned by 3 main colors: plot_cube(c(Seeblau, Pinky, Seegruen), type = "plane", theta = 10, phi = 20, main = "Gamut of 3 key colors")
post plots 1 or more text strings (provided as a character vector labels)
to an (existing or new) xbox.
post( labels, x = 0.03, y = 0.55, x_layout = NA, y_layout = "even", col = "white", col_bg = Seeblau, cex = 1, font = 1, new_plot = "none" )post( labels, x = 0.03, y = 0.55, x_layout = NA, y_layout = "even", col = "white", col_bg = Seeblau, cex = 1, font = 1, new_plot = "none" )
labels |
A character vector specifying the text labels to be plotted. |
x |
A numeric vector of x-coordinates at which the
text labels in |
y |
A numeric vector of y-coordinates at which the
text labels in |
x_layout |
An optional numeric vector or character string
to control the horizontal positions of |
y_layout |
A numeric value or character string
to control the vertical positions of |
col |
The color(s) of the text label(s).
Default: |
col_bg |
The background color(s) of the |
cex |
Numeric character expansion factor(s),
multiplied by |
font |
The font type(s) to be used.
Default: |
new_plot |
Should a new plot be generated?
Set to |
The positions of the text elements in labels can be specified by
providing their coordinates (as x and y arguments) or
by providing an initial position and an y_layout (see below).
Text formatting parameters (like col, col_bg, cex, font)
are recycled to match length(labels).
post uses the base graphics system graphics::.
xbox to create a new xbox (without text).
Other text functions:
mark(),
uline(),
url_unikn()
# Create a new xbox: post(labels = "This is a test.", new_plot = "xbox", cex = 1.2, font = 2, col_bg = pal_seeblau[[5]]) # Add text to an existing xbox: post(labels = c("More text follows here,", "yet another line here,", "and even more here."), y = .4, y_layout = .04, new_plot = "none") # Using x_layout and y_layout: post(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.4, font = 2, col = "white", col_bg = Pinky, x = .1, y = .5, x_layout = "left", y_layout = .05, new_plot = "xbox") post(labels = c("Hello world!", "Does this work?", "That's good!", "Please carry on..."), cex = 1.4, font = 2, col = "white", col_bg = Karpfenblau, x = .01, y = .6, x_layout = .10, y_layout = .05, new_plot = "xbox")# Create a new xbox: post(labels = "This is a test.", new_plot = "xbox", cex = 1.2, font = 2, col_bg = pal_seeblau[[5]]) # Add text to an existing xbox: post(labels = c("More text follows here,", "yet another line here,", "and even more here."), y = .4, y_layout = .04, new_plot = "none") # Using x_layout and y_layout: post(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."), cex = 1.4, font = 2, col = "white", col_bg = Pinky, x = .1, y = .5, x_layout = "left", y_layout = .05, new_plot = "xbox") post(labels = c("Hello world!", "Does this work?", "That's good!", "Please carry on..."), cex = 1.4, font = 2, col = "white", col_bg = Karpfenblau, x = .01, y = .6, x_layout = .10, y_layout = .05, new_plot = "xbox")
Seeblau provides the preferred color of pal_seeblau
(as an atomic HEX character value) and is defined as
pal_seeblau[[3]].
SeeblauSeeblau
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_seeblau for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Peach,
Petrol,
Pinky,
Seegruen,
Signal
Seeblau # HEX character "#59C7EB" (as value) all.equal(Seeblau, pal_seeblau[[3]]) # TRUE (same HEX values) seecol(Seeblau) # view color and detailsSeeblau # HEX character "#59C7EB" (as value) all.equal(Seeblau, pal_seeblau[[3]]) # TRUE (same HEX values) seecol(Seeblau) # view color and details
seecol provides an interface to plotting (or "seeing")
the colors of a palette or comparing multiple color palettes.
seecol( pal = "unikn_all", n = "all", alpha = NA, hex = NULL, rgb = NULL, col_bg = NULL, col_brd = NULL, lwd_brd = NULL, grid = TRUE, scale_x = FALSE, main = NA, sub = NULL, title = NULL, mar_note = NA, pal_names = NA, cube = FALSE, ... )seecol( pal = "unikn_all", n = "all", alpha = NA, hex = NULL, rgb = NULL, col_bg = NULL, col_brd = NULL, lwd_brd = NULL, grid = TRUE, scale_x = FALSE, main = NA, sub = NULL, title = NULL, mar_note = NA, pal_names = NA, cube = FALSE, ... )
pal |
A single color palette (as a vector of colors),
multiple color palettes (as a list),
or a recognized keyword (as a character string).
Default: Recognized keywords are:
|
n |
Number of colors to show or use.
If |
alpha |
A factor modifying the opacity alpha
(as |
hex |
Should HEX color values be shown?
Default: |
rgb |
Should RGB color values be shown?
Default: |
col_bg |
Color of plot background.
Default: |
col_brd |
Color of shape borders (if shown).
Default: |
lwd_brd |
Line width of shape borders (if shown).
Default: |
grid |
Show a reference grid in the color plot?
In the standard (swatch) view, this shows a background grid;
in the cube view (see |
scale_x |
Scale color shapes (when comparing multiple palettes) to a fixed total width?
Default: |
main |
Main plot title (as a character string).
Default: |
sub |
Optional subtitle (as a character string).
Default: |
title |
Deprecated plot title.
Use |
mar_note |
Optional margin note (on bottom right).
Default: |
pal_names |
Names of color palettes or colors
(as a character vector).
Default: |
cube |
Render a single color palette as points in a
3D RGB color cube (via
The cube also inherits the current |
... |
Other graphical parameters
(passed to |
seecol has two main modes, based on the contents of its pal argument:
if pal is set to a specific color palette (or a vector of multiple colors or color palettes):
Plot the current color palette and optional details on its colors.
if pal = "unikn_all" or a list of multiple color palettes:
Plot visual vectors of all current color palettes for comparing them.
Specifying distinct = TRUE removes visual duplicate colors (based on HEX values,
ignoring transparency), but only when showing an individual color palette pal.
Various title options (i.e., main, sub, and mar_note) and
a pal_names argument add control over plotted text labels.
However, the length of a character vector provided to pal_names must correspond
to the number of (custom) color palettes or colors.
usecol for using color palettes;
simcol for finding similar colors;
newpal for defining new color palettes;
grepal for finding named colors;
shades_of to defining shades of a given color;
ac for adjusting color transparency;
plot_cube for viewing colors in a 3D RGB color cube;
pal_unikn for the default uni.kn color palette.
Other color functions:
ac(),
demopal(),
grepal(),
newpal(),
plot_cube(),
shades_of(),
simcol(),
usecol()
# See multiple color palettes: seecol() # default: seecol(pal = "all") # See details of one color palette: seecol(pal_unikn) # see a specific color palette # Combining colors or color palettes: seecol(c(rev(pal_seeblau), pal_seegruen)) # combine color palettes seecol(c(rev(pal_seeblau), "white", pal_pinky)) # combine color palettes and color names seecol(c("black", "firebrick", "gold")) # combine color names # Scale a set of color palettes to a fixed width: seecol(scale_x = TRUE) # Using n to reduce or extend color palettes: seecol(n = 3) # viewing reduced ranges of all palettes seecol(n = 12) # viewing extended ranges of all palettes seecol(pal_unikn, n = 5, main = "Reduced version of pal_unikn (n = 5)") # reducing pal_unikn seecol(pal_seeblau, n = 8, main = "Extended version of pal_seeblau (n = 8)") # extending pal_seeblau # Combining and extending color palettes: seecol(c(rev(pal_seeblau), "white", pal_bordeaux), n = 17, main = "Diverging custom color palette (with 17 colors)") # Defining custom color palettes: pal_mpg <- c("#007367", "white", "#D0D3D4") # mixing hex values and color names names(pal_mpg) <- c("mpg green", "mpg white", "mpg grey") # color names pal_bdg <- usecol(c(Bordeaux, "gold"), n = 5) # using usecol # Viewing extended color palette: seecol(pal_mpg, n = 9, main = "Custom color palette of the Max Planck Society") # Comparing (and labeling) custom color palettes: seecol(list(pal_mpg, pal_bdg, pal_unikn), scale_x = TRUE, pal_names = c("Max Planck", "Bordeaux-Gold", "Uni Konstanz"), main = "Comparing and labeling custom color palettes") # Viewing a single palette in a 3D RGB color cube (using plot_cube()): seecol(pal_unikn, cube = TRUE) # default cube view (with color names) seecol(pal_unikn_pref, cube = TRUE, hex = TRUE) # add HEX labels to points seecol(pal_pinky, grid = FALSE, # pass arguments to plot_cube() cube = list(type = "b", theta = -35, line_connect = "path", shadows = "all")) ## Viewing palettes from other color packages: # library(RColorBrewer) # seecol(brewer.pal(name = "RdBu", n = 9)) # view color palette # seecol(brewer.pal(name = "RdBu", n = 9), cube = TRUE) # view in 3D color cube # seecol(brewer.pal(name = "RdBu", n = 9), n = 15) # extend to 15 colors# See multiple color palettes: seecol() # default: seecol(pal = "all") # See details of one color palette: seecol(pal_unikn) # see a specific color palette # Combining colors or color palettes: seecol(c(rev(pal_seeblau), pal_seegruen)) # combine color palettes seecol(c(rev(pal_seeblau), "white", pal_pinky)) # combine color palettes and color names seecol(c("black", "firebrick", "gold")) # combine color names # Scale a set of color palettes to a fixed width: seecol(scale_x = TRUE) # Using n to reduce or extend color palettes: seecol(n = 3) # viewing reduced ranges of all palettes seecol(n = 12) # viewing extended ranges of all palettes seecol(pal_unikn, n = 5, main = "Reduced version of pal_unikn (n = 5)") # reducing pal_unikn seecol(pal_seeblau, n = 8, main = "Extended version of pal_seeblau (n = 8)") # extending pal_seeblau # Combining and extending color palettes: seecol(c(rev(pal_seeblau), "white", pal_bordeaux), n = 17, main = "Diverging custom color palette (with 17 colors)") # Defining custom color palettes: pal_mpg <- c("#007367", "white", "#D0D3D4") # mixing hex values and color names names(pal_mpg) <- c("mpg green", "mpg white", "mpg grey") # color names pal_bdg <- usecol(c(Bordeaux, "gold"), n = 5) # using usecol # Viewing extended color palette: seecol(pal_mpg, n = 9, main = "Custom color palette of the Max Planck Society") # Comparing (and labeling) custom color palettes: seecol(list(pal_mpg, pal_bdg, pal_unikn), scale_x = TRUE, pal_names = c("Max Planck", "Bordeaux-Gold", "Uni Konstanz"), main = "Comparing and labeling custom color palettes") # Viewing a single palette in a 3D RGB color cube (using plot_cube()): seecol(pal_unikn, cube = TRUE) # default cube view (with color names) seecol(pal_unikn_pref, cube = TRUE, hex = TRUE) # add HEX labels to points seecol(pal_pinky, grid = FALSE, # pass arguments to plot_cube() cube = list(type = "b", theta = -35, line_connect = "path", shadows = "all")) ## Viewing palettes from other color packages: # library(RColorBrewer) # seecol(brewer.pal(name = "RdBu", n = 9)) # view color palette # seecol(brewer.pal(name = "RdBu", n = 9), cube = TRUE) # view in 3D color cube # seecol(brewer.pal(name = "RdBu", n = 9), n = 15) # extend to 15 colors
Seegruen provides the preferred color of pal_seegruen
(as an atomic HEX character value) and is defined as
pal_seegruen[[4]].
SeegruenSeegruen
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_seegruen for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Peach,
Petrol,
Pinky,
Seeblau,
Signal
Seegruen # HEX character "#0A9086" (as value) all.equal(Seegruen, pal_seegruen[[4]]) # TRUE (same HEX values) seecol(Seegruen) # view color and detailsSeegruen # HEX character "#0A9086" (as value) all.equal(Seegruen, pal_seegruen[[4]]) # TRUE (same HEX values) seecol(Seegruen) # view color and details
shades_of returns a vector of n colors that are
shades of a color gradient ranging
from an initial color col_1 to a final color col_n.
shades_of(n = 5, col_1 = "black", col_n = "white", alpha = NA)shades_of(n = 5, col_1 = "black", col_n = "white", alpha = NA)
n |
Number of desired colors.
Default: |
col_1 |
Initial color.
Default: |
col_n |
Final (n-th) color.
Default: |
alpha |
A factor modifying the opacity alpha
(as |
By default, the color gradient returned contains n = 5 colors
that range from the initial color col_1 = "black"
to the final color col_n = "white".
Specifying different values for n and the
initial or final colors yields different color ranges.
shades_of is mostly a wrapper for a special usecol command.
However, usecol allows defining more
complex color gradients (e.g., by specifying more than two colors).
seecol for viewing and comparing color palettes;
usecol for using color palettes;
simcol for finding similar colors;
newpal for defining new color palettes;
grepal for finding named colors;
ac for adjusting color transparency.
Other color functions:
ac(),
demopal(),
grepal(),
newpal(),
plot_cube(),
seecol(),
simcol(),
usecol()
grey50 <- shades_of(50, col_1 = 'grey1') seecol(grey50, main = "50 shades of grey1") blue_black <- shades_of(5, Seeblau, col_n = "black") seecol(blue_black, main = "5 shades from Seeblau to black") wine_white <- shades_of(6, Bordeaux, alpha = 1/2) seecol(wine_white, col_brd = "black", lwd_brd = .5, main = "Shades of semi-transparent Bordeaux")grey50 <- shades_of(50, col_1 = 'grey1') seecol(grey50, main = "50 shades of grey1") blue_black <- shades_of(5, Seeblau, col_n = "black") seecol(blue_black, main = "5 shades from Seeblau to black") wine_white <- shades_of(6, Bordeaux, alpha = 1/2) seecol(wine_white, col_brd = "black", lwd_brd = .5, main = "Shades of semi-transparent Bordeaux")
Signal provides the alert color of pal_signal
(as an atomic HEX character value) and is defined as
pal_signal[2].
SignalSignal
The official specification of pal_signal
does not identify a preferred color.
We provide Signal as a dedicated color
as it is suited for creating color gradients
(see usecol).
See https://www.uni-konstanz.de/en/university/news-and-media/create-online-and-print-media/corporate-design/ for details.
pal_signal for the corresponding color palette;
pal_unikn for the unikn default color palette with all 5 colors of pal_seeblau;
pal_unikn_pref for a uni.kn color palette with all preferred colors;
seecol for viewing and comparing color palettes;
usecol for using color palettes.
Other preferred colors:
Bordeaux,
Grau,
Karpfenblau,
Peach,
Petrol,
Pinky,
Seeblau,
Seegruen
Signal # HEX character "#EFDC60" (as value) all.equal(Signal, pal_signal[[2]]) # TRUE (same HEX values) seecol(Signal) # view color and detailsSignal # HEX character "#EFDC60" (as value) all.equal(Signal, pal_signal[[2]]) # TRUE (same HEX values) seecol(Signal) # view color and details
simcol finds and shows colors
from a palette of color candidates col_candidates that are similar
to some target color col_target.
simcol( col_target, col_candidates = colors(), tol = c(25, 50, 75), distinct = TRUE, plot = TRUE )simcol( col_target, col_candidates = colors(), tol = c(25, 50, 75), distinct = TRUE, plot = TRUE )
col_target |
A (required) target color. |
col_candidates |
A palette of color candidates to be considered.
Default: |
tol |
Numeric tolerance value(s)
(either 1 or 3 numeric values, in the RGB range from 0 to 255).
Values are considered in the order of the RGB value rank in |
distinct |
Boolean: Return only visually distinct colors?
Default: |
plot |
Boolean: Plot the output (using |
simcol returns a vector of the (named) colors or color values in
col_candidates (set to colors() of grDevices per default)
that are similar to the specified target color col_target.
If plot = TRUE, simcol also visualizes the detected colors
(by passing its result to seecol, as a side-effect).
Color similarity is defined in terms of the distance between colors' RGB values,
which must be within the numeric tolerance threshold(s) specified by tol
(with 0 <= tol <= 255).
Higher tol values correspond to more permissive similarity judgments.
If tol is a scalar, the values of all three RGB dimensions
of col_candidates must be within the corresponding values of
col_target to be judged as 'similar'.
If tol contains three values, the three RGB dimension are compared
in order of the dimensions' rank in col_target
(i.e., the primary dimension must be within tol[1], etc.).
Thus, providing three tol values allows for
more fine-grained similarity matching.
A named vector of colors or color values.
seecol for plotting/seeing color palettes;
usecol for using color palettes;
newpal for defining new color palettes;
grepal for finding named colors;
shades_of to defining shades of a given color;
ac for adjusting color transparency.
Other color functions:
ac(),
demopal(),
grepal(),
newpal(),
plot_cube(),
seecol(),
shades_of(),
usecol()
# Basic uses: simcol(col_target = "red") simcol("tan", tol = 15) simcol(Seeblau, tol = c(20, 30, 40)) simcol("blue", col_candidates = pal_unikn_pref, tol = 120) # Fine-tuning the range of color matching: simcol(Seeblau, tol = 30) # = simcol(Seeblau, tol = c(30, 30, 30)) simcol(Seeblau, tol = c(20, 20, 80)) # Increasing tolerance widens range: simcol("grey", c("white", "grey", "black"), tol = 255, distinct = FALSE, plot = FALSE)# Basic uses: simcol(col_target = "red") simcol("tan", tol = 15) simcol(Seeblau, tol = c(20, 30, 40)) simcol("blue", col_candidates = pal_unikn_pref, tol = 120) # Fine-tuning the range of color matching: simcol(Seeblau, tol = 30) # = simcol(Seeblau, tol = c(30, 30, 30)) simcol(Seeblau, tol = c(20, 20, 80)) # Increasing tolerance widens range: simcol("grey", c("white", "grey", "black"), tol = 255, distinct = FALSE, plot = FALSE)
slide plots an empty slide (or frame)
as a colored rectangle.
slide(col = NA, dim = c(4/3, 1), border = grey(0.33, 1), lwd = 1.5)slide(col = NA, dim = c(4/3, 1), border = grey(0.33, 1), lwd = 1.5)
col |
The color to fill the slide with (i.e., its background color).
Default: |
dim |
The x- and y-dimensions of the slide.
Default: |
border |
The color of the slide's border.
Setting |
lwd |
The line width of the slide's border.
Setting |
heading, line, or mark to add text to a slide;
xbox to plot a box.
Other plot functions:
theme_bwkn(),
theme_grau(),
theme_minikn(),
theme_unikn(),
xbox()
slide() # default slide (or frame) slide(lwd = NA) # borderless slide # Dimensions: slide(dim = c(18, 9)) # larger and 2:1 dimensions slide(dim = c(1/3, 1)) # smaller and 1:3 dimensions # Formatting: slide(col = pal_seeblau[[1]], border = pal_seeblau[[5]], lwd = 2)slide() # default slide (or frame) slide(lwd = NA) # borderless slide # Dimensions: slide(dim = c(18, 9)) # larger and 2:1 dimensions slide(dim = c(1/3, 1)) # smaller and 1:3 dimensions # Formatting: slide(col = pal_seeblau[[1]], border = pal_seeblau[[5]], lwd = 2)
theme_bwkn provides an alternative bw theme
for use in ggplot2 and unikn contexts.
theme_bwkn( col_title = grey(0.1, 1), col_line = grey(0.4, 1), base_size = 12, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )theme_bwkn( col_title = grey(0.1, 1), col_line = grey(0.4, 1), base_size = 12, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )
col_title |
Color of text elements
used for plot title, axis titles, and legend (optional).
Default: |
col_line |
Color of line elements
used for axis lines, text and ticks, plot caption and subtitle, and panel border.
Default: |
base_size |
Base font size (optional, numeric).
Default: |
base_family |
Base font family (optional, character).
Default: |
base_line_size |
Base line size (optional, numeric).
Default: |
base_rect_size |
Base rectangle size (optional, numeric).
Default: |
axis_ticks_mm |
Length of axis ticks (in mm).
Default: |
theme_bwkn is light and no-nonsense,
and based on theme_bw.
This theme works well for most visualizations that require grid and plot panel boundaries.
theme_unikn for default theme;
theme_grau for a grey theme;
theme_minikn for a minimal theme.
Other plot functions:
slide(),
theme_grau(),
theme_minikn(),
theme_unikn(),
xbox()
# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_bwkn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "C", title = "Iris sepals by species (using theme_bwkn)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_bwkn()# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_bwkn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "C", title = "Iris sepals by species (using theme_bwkn)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_bwkn()
theme_grau provides an alternative grey theme
for use in ggplot2 and unikn contexts.
theme_grau( col_title = grey(0, 1), col_line = pal_grau[[3]], base_size = 11, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )theme_grau( col_title = grey(0, 1), col_line = pal_grau[[3]], base_size = 11, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )
col_title |
Color of title elements (optional).
Default: |
col_line |
Color of line elements
used for axis ticks (optional).
Default: |
base_size |
Base font size (optional, numeric).
Default: |
base_family |
Base font family (optional, character).
Default: |
base_line_size |
Base line size (optional, numeric).
Default: |
base_rect_size |
Base rectangle size (optional, numeric).
Default: |
axis_ticks_mm |
Length of axis ticks (in mm).
Default: |
theme_grau is no-nonsense, but fills
panel backgrounds in "grau" (specifically, pal_seeggrau[[1]]).
This theme works well for dark colors and bright color accents, but is of limited use with transparent colors.
theme_unikn for default theme;
theme_bwkn for a bw theme;
theme_minikn for a minimal theme.
Other plot functions:
slide(),
theme_bwkn(),
theme_minikn(),
theme_unikn(),
xbox()
# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_grau requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "B", title = "Iris sepals by species (using theme_grau)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_grau()# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_grau requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "B", title = "Iris sepals by species (using theme_grau)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_grau()
theme_minikn provides an alternative minimal theme
for use in ggplot2 and unikn contexts.
theme_minikn( col_title = grey(0.1, 1), col_line = grey(0.4, 1), base_size = 12, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 1 )theme_minikn( col_title = grey(0.1, 1), col_line = grey(0.4, 1), base_size = 12, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 1 )
col_title |
Color of text elements
used for plot, axis and legend titles, as well as for strip titles.
Default: |
col_line |
Color of line elements
used for axis lines, text and ticks, and for plot caption and subtitle.
Default: |
base_size |
Base font size (optional, numeric).
Default: |
base_family |
Base font family (optional, character).
Default: |
base_line_size |
Base line size (optional, numeric).
Default: |
base_rect_size |
Base rectangle size (optional, numeric).
Default: |
axis_ticks_mm |
Length of axis ticks (in mm).
Default: |
theme_minikn is a minimal and no-nonsense,
and based on theme_minimal.
This theme works well for most visualizations that do not require grid lines or panel boundaries.
theme_unikn for default theme;
theme_grau for a grey theme;
theme_bwkn for a bw theme.
Other plot functions:
slide(),
theme_bwkn(),
theme_grau(),
theme_unikn(),
xbox()
# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_minikn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "D", title = "Iris sepals by species (using theme_minikn)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_minikn()# Plotting iris dataset (using ggplot2, theme_grau, and unikn colors): library('ggplot2') # theme_minikn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Sepal.Length, y = Sepal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "D", title = "Iris sepals by species (using theme_minikn)", caption = "Data from datasets::iris") + coord_fixed(ratio = 3/2) + theme_minikn()
theme_unikn provides a basic unikn theme
to use in ggplot2 commands.
theme_unikn( col_title = pal_seeblau[[4]], col_line = grey(0.05, 1), base_size = 11, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )theme_unikn( col_title = pal_seeblau[[4]], col_line = grey(0.05, 1), base_size = 11, base_family = "sans", base_line_size = base_size/22, base_rect_size = base_size/22, axis_ticks_mm = 2 )
col_title |
Color of the plot title (optional).
Default: |
col_line |
Color of line elements
used for axis lines and ticks, strip and panel border.
Default: |
base_size |
Base font size (optional, numeric).
Default: |
base_family |
Base font family (optional, character).
Default: |
base_line_size |
Base line size (optional, numeric).
Default: |
base_rect_size |
Base rectangle size (optional, numeric).
Default: |
axis_ticks_mm |
Length of axis ticks (in mm).
Default: |
The theme is lightweight and no-nonsense, but somewhat opinionated (e.g., in using mostly grey scales to allow emphasizing data points with color accents).
theme_grau for a grey theme;
theme_bwkn for a bw theme;
theme_minikn for a minimal theme.
Other plot functions:
slide(),
theme_bwkn(),
theme_grau(),
theme_minikn(),
xbox()
# Plotting iris dataset (using ggplot2, theme_unikn, and unikn colors): library('ggplot2') # theme_unikn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Petal.Length, y = Petal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "A", title = "Iris petals by species (using theme_unikn)", caption = "Data from datasets::iris") + theme_unikn()# Plotting iris dataset (using ggplot2, theme_unikn, and unikn colors): library('ggplot2') # theme_unikn requires ggplot2 ggplot(datasets::iris) + geom_jitter(aes(x = Petal.Length, y = Petal.Width, color = Species), size = 3, alpha = 2/3) + facet_wrap(~Species) + scale_color_manual(values = usecol(pal = c(Pinky, Seeblau, Seegruen))) + labs(tag = "A", title = "Iris petals by species (using theme_unikn)", caption = "Data from datasets::iris") + theme_unikn()
uline plots 1 or more text strings (provided as a character vector labels)
to an (existing or new) plot and places a colored line underneath
each label (to underline it).
uline( labels, x = 0, y = 0.55, x_layout = NA, y_layout = "even", col = "black", col_bg = Seeblau, cex = 1.5, font = 1, new_plot = "none" )uline( labels, x = 0, y = 0.55, x_layout = NA, y_layout = "even", col = "black", col_bg = Seeblau, cex = 1.5, font = 1, new_plot = "none" )
labels |
A character vector specifying the text labels to be plotted. |
x |
A numeric vector of x-coordinates at which the
text labels in |
y |
A numeric vector of y-coordinates at which the
text labels in |
x_layout |
An optional numeric vector or character string
to control the horizontal positions of |
y_layout |
A numeric value or character string
to control the vertical positions of |
col |
The color(s) of the text label(s).
Default: |
col_bg |
The color(s) of the line (under the text labels
of |
cex |
Numeric character expansion factor(s),
multiplied by |
font |
The font type(s) to be used.
Default: |
new_plot |
Boolean: Should a new plot be generated?
Set to |
The positions of the text elements in labels can be specified by
providing their coordinates (as x and y arguments) or
by providing an initial position and an y_layout (see below).
Text formatting parameters (like col, col_bg, cex, font)
are recycled to match length(labels).
uline uses the base graphics system graphics::.
slide and xbox to create simple plots (without text).
Other text functions:
mark(),
post(),
url_unikn()
uline(labels = "This is a test.", new_plot = "blank") # create a new blank plot uline(labels = "More testing here...", y = .33, col_bg = pal_pinky[[2]]) # add to plot # 2 basic cases: # (a) Underline text on an existing plot: plot(x = 0, y = 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), xlab = "", ylab = "") uline(x = 0, y = .8, labels = "Underline text (on an existing plot)") # add to plot # (b) Underline text on a new plot: uline(x = .02, y = .80, labels = "Underline text (on a new plot)", new_plot = "slide") # create a new plot # Example: lbl_line <- c("This is neat, true, and terribly important.") uline(labels = lbl_line, new_plot = "blank") # create a new plot uline(labels = "(which is why we underline it).", y = .40, cex = 1.2) # add to plotuline(labels = "This is a test.", new_plot = "blank") # create a new blank plot uline(labels = "More testing here...", y = .33, col_bg = pal_pinky[[2]]) # add to plot # 2 basic cases: # (a) Underline text on an existing plot: plot(x = 0, y = 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), xlab = "", ylab = "") uline(x = 0, y = .8, labels = "Underline text (on an existing plot)") # add to plot # (b) Underline text on a new plot: uline(x = .02, y = .80, labels = "Underline text (on a new plot)", new_plot = "slide") # create a new plot # Example: lbl_line <- c("This is neat, true, and terribly important.") uline(labels = lbl_line, new_plot = "blank") # create a new plot uline(labels = "(which is why we underline it).", y = .40, cex = 1.2) # add to plot
Open the unikn package guides
unikn.guide()unikn.guide()
url_unikn formats an URL the uni.kn wayurl_unikn removes various patterns (e.g.,
"http", "https", "://", "www.") from the
front of a given URL and returns the remaining character string
with an n-dash (Unicode \u2013) prefix,
rather than the former figure dash (\u2012) prefix
(as the latter created issues on Fedora Linux systems).
url_unikn(url = "https://www.uni-konstanz.de/")url_unikn(url = "https://www.uni-konstanz.de/")
url |
The url to be written (as copied from a web browser). |
xbox to create a new xbox (without text).
Other text functions:
mark(),
post(),
uline()
url_unikn("https://www.uni-konstanz.de/")url_unikn("https://www.uni-konstanz.de/")
usecol allows using a color or color palette pal (e.g., for plotting).
usecol( pal = pal_unikn, n = "all", alpha = NA, distinct = FALSE, use_names = FALSE, use_col_ramp = FALSE )usecol( pal = pal_unikn, n = "all", alpha = NA, distinct = FALSE, use_names = FALSE, use_col_ramp = FALSE )
pal |
A color palette (as a vector of colors or color palettes).
Default: |
n |
An integer value specifying the desired number of colors from the palette.
Default: |
alpha |
A factor modifying the opacity alpha
(as |
distinct |
Boolean: Return only visually distinct colors?
Default: |
use_names |
A logical value indicating whether colors should be returned as a named vector.
Default: |
use_col_ramp |
A logical value specifying whether the default of using pre-selected colors
should be overridden and |
usecol also allows modifying and combining color palettes in various ways.
A (named) vector of colors (of type character).
seecol for viewing and comparing color palettes;
simcol for finding similar colors;
newpal for defining new color palettes;
grepal for finding named colors;
shades_of to defining shades of a given color;
ac for adjusting color transparency;
pal_unikn for the default uni.kn color palette.
Other color functions:
ac(),
demopal(),
grepal(),
newpal(),
plot_cube(),
seecol(),
shades_of(),
simcol()
usecol(pal = pal_unikn, n = "all") # default color palette usecol(pal = pal_unikn, n = 4) # selecting n dedicated colors usecol(pal = pal_unikn, n = 20) # extending color palette # Mixing a new color palette: pal_1 <- usecol(pal = c(rev(pal_seeblau), "white", pal_pinky)) seecol(pal_1) # Mixing and extending a color palette: pal_2 <- usecol(pal = c(rev(pal_seegruen), "white", pal_bordeaux), n = 20) seecol(pal_2) # Defining and using a custom color palette: pal_princeton_1 <- c("#E77500", "white", "black") names(pal_princeton_1) <- c("orange_w", "white", "black") pal_3 <- usecol(pal_princeton_1, n = 7) seecol(pal_3) # Removing visual duplicates: usecol(c("black", "#000000", "gray", "grey", "red", "red1"), distinct = TRUE) seecol(usecol(c(pal_unikn, pal_seeblau), distinct = TRUE), title = "Using distinct colors")usecol(pal = pal_unikn, n = "all") # default color palette usecol(pal = pal_unikn, n = 4) # selecting n dedicated colors usecol(pal = pal_unikn, n = 20) # extending color palette # Mixing a new color palette: pal_1 <- usecol(pal = c(rev(pal_seeblau), "white", pal_pinky)) seecol(pal_1) # Mixing and extending a color palette: pal_2 <- usecol(pal = c(rev(pal_seegruen), "white", pal_bordeaux), n = 20) seecol(pal_2) # Defining and using a custom color palette: pal_princeton_1 <- c("#E77500", "white", "black") names(pal_princeton_1) <- c("orange_w", "white", "black") pal_3 <- usecol(pal_princeton_1, n = 7) seecol(pal_3) # Removing visual duplicates: usecol(c("black", "#000000", "gray", "grey", "red", "red1"), distinct = TRUE) seecol(usecol(c(pal_unikn, pal_seeblau), distinct = TRUE), title = "Using distinct colors")
xbox plots a box with a cross (x) in its top-right corner.
xbox(col = Seeblau, dim = c(1, 1), use_x = TRUE)xbox(col = Seeblau, dim = c(1, 1), use_x = TRUE)
col |
The color to fill the box with (i.e., its background color).
Default: |
dim |
The x- and y-dimensions of the box (as numeric).
Default: |
use_x |
Plot a cross in upper right corner (as logical)?
Default: |
The cross (x) appears rectangular when viewing the plot
at the correct aspect ratio (as defined by dim).
post to add text to an xbox;
slide to plot a new slide (or frame).
Other plot functions:
slide(),
theme_bwkn(),
theme_grau(),
theme_minikn(),
theme_unikn()
xbox() # default box # Options: xbox(col = Bordeaux) xbox(dim = c(2, 1)) # 2:1 dimension (wider than high)xbox() # default box # Options: xbox(col = Bordeaux) xbox(dim = c(2, 1)) # 2:1 dimension (wider than high)