Description Usage Arguments See Also Examples
newpal
ermoeglicht die Definition neuer Farbpaletten
(als data frames).
1 |
col |
Ein erforderlicher Farbvektor (angegeben durch R-Farbnamen, HEX-Codes oder RGB-Werte). |
names |
Ein optionaler character Vektor mit Namen.
Default: |
as_df |
Soll die neue Farbpalette zurueckgegeben werden als
data frame (statt als Vektor)?
Default: |
seepal
um eine Farbpalette zu plotten;
usecol
um eine Farbpalette zu verwenden.
Other Farbfunktionen:
seecol()
,
usecol()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | newpal(col = c("black", "white"), names = c("dark", "bright"))
# Example: 3 Arten eine neue Farbpalette zu definieren:
# (1) Mit R Farbnamen: -----
pal_flag_de <- newpal(col = c("black", "firebrick3", "gold"),
names = c("Schwarz", "Rot", "Gold"))
seecol(pal_flag_de, title = "Farben der deutschen Flagge")
# (2) Mit HEX-Codes: -----
# (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)
seecol(pal_google, title = "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, title = "Colors of the German flag (www.schemecolor.com)")
# (c) MPG colors:
pal_mpg <- newpal(col = c("#007367", "white", "#D0D3D4"),
names = c("mpg green", "white", "mpg grey")
)
seecol(pal_mpg, title = "Colors of the Max Planck Society")
# (3) From RGB values: -----
## Not run:
library(grDevices)
# 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)
seecol(pal_okabe_ito,
title = "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 = 5,
title = "Comparing custom color palettes")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.