| 1 |
library("colorspace") |
| 2 |
|
| 3 |
## qualitative palette |
| 4 |
rainbow_hcl(12) |
| 5 |
|
| 6 |
## a few useful diverging HCL palettes |
| 7 |
diverging_hcl(7) |
| 8 |
diverging_hcl(7, h = c(246, 40), c = 96, l = c(65, 90)) |
| 9 |
diverging_hcl(7, h = c(130, 43), c = 100, l = c(70, 90)) |
| 10 |
diverging_hcl(7, h = c(180, 70), c = 70, l = c(90, 95)) |
| 11 |
diverging_hcl(7, h = c(180, 330), c = 59, l = c(75, 95)) |
| 12 |
diverging_hcl(7, h = c(128, 330), c = 98, l = c(65, 90)) |
| 13 |
diverging_hcl(7, h = c(255, 330), l = c(40, 90)) |
| 14 |
diverging_hcl(7, c = 100, l = c(50, 90), power = 1) |
| 15 |
|
| 16 |
## sequential palettes |
| 17 |
sequential_hcl(12) |
| 18 |
heat_hcl(12, h = c(0, -100), l = c(75, 40), c = c(40, 80), power = 1) |
| 19 |
terrain_hcl(12, c = c(65, 0), l = c(45, 95), power = c(1/3, 1.5)) |
| 20 |
heat_hcl(12, c = c(80, 30), l = c(30, 90), power = c(1/5, 1.5)) |
| 21 |
rainbow_hcl(12) |
| 22 |
desaturate(rainbow_hcl(12)) |
| 23 |
|
| 24 |
## diverging red-blue colors |
| 25 |
diverging_hsv(7) |
| 26 |
diverging_hcl(7, c = 100, l = c(50, 90)) |
| 27 |
desaturate(diverging_hsv(7)) |
| 28 |
desaturate(diverging_hcl(7, c = 100, l = c(50, 90))) |
| 29 |
|
| 30 |
## diverging cyan-magenta colors |
| 31 |
diverging_hcl(7, h = c(180, 330), c = 59, l = c(75, 95)) |
| 32 |
desaturate(diverging_hcl(7, h = c(180, 330), c = 59, l = c(75, 95))) |
| 33 |
|
| 34 |
## heat and terrain colors |
| 35 |
heat_hcl(12) |
| 36 |
desaturate(heat_hcl(12)) |
| 37 |
terrain_hcl(12) |
| 38 |
desaturate(terrain_hcl(12)) |
| 39 |
|
| 40 |
## different interfaces |
| 41 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, palette = "Pastel 1")) |
| 42 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h = 0, c = 35, l = 85)) |
| 43 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h = c(0, 300), c = 35, l = 85)) |
| 44 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h = c(0, NA), c = 35, l = 85)) |
| 45 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h1 = 0, c1 = 35, l1 = 85)) |
| 46 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h1 = 0, h2 = NA, c1 = 35, l1 = 85)) |
| 47 |
identical(qualitative_hcl(6, "Pastel 1"), qualitative_hcl(6, h1 = 0, h2 = 300, c1 = 35, l1 = 85)) |
| 48 |
identical(sequential_hcl(7, "Grays"), sequential_hcl(7, palette = "Grays")) |
| 49 |
identical(sequential_hcl(7, "Grays"), sequential_hcl(7, h = 0, c = 0, l = c(15, 98), power = 1.3)) |
| 50 |
identical(sequential_hcl(7, "Grays"), sequential_hcl(7, h = 0, c. = 0, l = c(15, 98), power = 1.3)) |
| 51 |
identical(sequential_hcl(7, "Grays"), sequential_hcl(7, c1 = 0, c2 = 0, l1 = 15, l2 = 98, p1 = 1.3)) |
| 52 |
identical(sequential_hcl(7, "Red-Yellow"), sequential_hcl(7, palette = "Red-Yellow")) |
| 53 |
identical(sequential_hcl(7, "Red-Yellow"), sequential_hcl(7, h = c(10, 85), c = c(80, 10), l = c(25, 95), power = c(0.4, 1.3))) |
| 54 |
identical(sequential_hcl(7, "Red-Yellow"), sequential_hcl(7, h = c(10, 85), c. = c(80, 10), l = c(25, 95), power = c(0.4, 1.3))) |
| 55 |
identical(sequential_hcl(7, "Red-Yellow"), sequential_hcl(7, h1 = 10, h2 = 85, c1 = 80, c2 = 10, l1 = 25, l2 = 95, p1 = 0.4, p2 = 1.3)) |
| 56 |
identical(diverging_hcl(7, "Blue-Red 3"), diverging_hcl(7, palette = "Blue-Red 3")) |
| 57 |
identical(diverging_hcl(7, "Blue-Red 3"), diverging_hcl(7, h = c(265, 12), c = 80, l = c(25, 95), power = 0.7)) |
| 58 |
identical(diverging_hcl(7, "Blue-Red 3"), diverging_hcl(7, h1 = 265, h2 = 12, c1 = 80, l1 = 25, l2 = 95, p1 = 0.7)) |