Prints either a visual preview of each palette or the associated hex values.

bi_pal(pal, dim = 3, preview = TRUE)

Arguments

pal

A palette name; one of "Brown", "DkBlue", "DkCyan", "DkViolet", or "GrPink".

dim

The dimensions of the palette, either 2 for a two-by-two palette or 3 for a three-by-three palette.

preview

A logical scalar; if TRUE (default), an image preview will be generated. If FALSE, a vector with hex color values will be returned.

Value

If preview = TRUE, an image preview of the legend will be returned. Otherwise, if preview = FALSE, a named vector with class values for names and their corresponding hex color values.

Details

The "Brown", "DkBlue", "DkCyan", and "GrPink" palettes were made by Joshua Stevens. The "DkViolet" palette was made by Timo Grossenbacher and Angelo Zehr.

Examples

# brown palette, 2x2 preview bi_pal(pal = "Brown", dim = 2)
# brown palette, 2x2 hex values bi_pal(pal = "Brown", dim = 2, preview = FALSE)
#> 2-2 1-2 2-1 1-1 #> "#804D36" "#9972AF" "#C8B35A" "#E8E8E8"
# brown palette, 3x3 preview bi_pal(pal = "Brown", dim = 3)
# brown palette, 3x3 hex values bi_pal(pal = "Brown", dim = 3, preview = FALSE)
#> 3-3 2-3 1-3 3-2 2-2 1-2 3-1 2-1 #> "#804D36" "#976B82" "#9972AF" "#AF8E53" "#C8ADA0" "#CBB8D7" "#C8B35A" "#E4D9AC" #> 1-1 #> "#E8E8E8"
# dark blue palette, 2x2 preview bi_pal(pal = "DkBlue", dim = 2)
# dark blue palette, 2x2 hex values bi_pal(pal = "DkBlue", dim = 2, preview = FALSE)
#> 2-2 1-2 2-1 1-1 #> "#3B4994" "#BE64AC" "#5AC8C8" "#E8E8E8"
# dark blue palette, 3x3 preview bi_pal(pal = "DkBlue", dim = 3)
# dark blue palette, 3x3 hex values bi_pal(pal = "DkBlue", dim = 3, preview = FALSE)
#> 3-3 2-3 1-3 3-2 2-2 1-2 3-1 2-1 #> "#3B4994" "#8C62AA" "#BE64AC" "#5698B9" "#A5ADD3" "#DFB0D6" "#5AC8C8" "#ACE4E4" #> 1-1 #> "#E8E8E8"
# dark cyan palette, 2x2 bi_pal(pal = "DkCyan", dim = 2)
# dark cyan palette, 2x2 hex values bi_pal(pal = "DkCyan", dim = 2, preview = FALSE)
#> 2-2 1-2 2-1 1-1 #> "#2A5A5B" "#73AE80" "#6C83B5" "#E8E8E8"
# dark cyan palette, 3x3 bi_pal(pal = "DkCyan", dim = 3)
# dark cyan palette, 3x3 hex values bi_pal(pal = "DkCyan", dim = 3, preview = FALSE)
#> 3-3 2-3 1-3 3-2 2-2 1-2 3-1 2-1 #> "#2A5A5B" "#5A9178" "#73AE80" "#567994" "#90B2B3" "#B8D6BE" "#6C83B5" "#B5C0DA" #> 1-1 #> "#E8E8E8"
# dark violet palette, 2x2 bi_pal(pal = "DkViolet", dim = 2)
# dark violet palette, 2x2 hex values bi_pal(pal = "DkViolet", dim = 2, preview = FALSE)
#> 2-2 1-2 2-1 1-1 #> "#3F2949" "#4885C1" "#AE3A4E" "#CABED0"
# dark violet palette, 3x3 bi_pal(pal = "DkViolet", dim = 3)
# dark violet palette, 3x3 hex values bi_pal(pal = "DkViolet", dim = 3, preview = FALSE)
#> 3-3 2-3 1-3 3-2 2-2 1-2 3-1 2-1 #> "#3F2949" "#435786" "#4885C1" "#77324C" "#806A8A" "#89A1C8" "#AE3A4E" "#BC7C8F" #> 1-1 #> "#CABED0"
# gray pink palette, 2x2 bi_pal(pal = "GrPink", dim = 2)
# gray pink palette, 2x2 hex values bi_pal(pal = "GrPink", dim = 2, preview = FALSE)
#> 2-2 1-2 2-1 1-1 #> "#574249" "#64ACBE" "#C85A5A" "#E8E8E8"
# gray pink palette, 3x3 bi_pal(pal = "GrPink", dim = 3)
# gray pink palette, 3x3 hex values bi_pal(pal = "GrPink", dim = 3, preview = FALSE)
#> 3-3 2-3 1-3 3-2 2-2 1-2 3-1 2-1 #> "#574249" "#627F8C" "#64ACBE" "#985356" "#AD9EA5" "#B0D5DF" "#C85A5A" "#E4ACAC" #> 1-1 #> "#E8E8E8"