Redrawing join diagrams
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 205 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 54 KiB |
|
@ -0,0 +1,38 @@
|
|||
library(farver)
|
||||
library(dplyr, warn.conflicts = FALSE)
|
||||
|
||||
oreilly <- tribble(
|
||||
~ name, ~r, ~g, ~b,
|
||||
"blue", 0, 113, 188,
|
||||
"orange", 247, 147, 30,
|
||||
"red", 193, 39, 45,
|
||||
"green", 0, 146, 68,
|
||||
"yellow", 255, 222, 0,
|
||||
"purple", 153, 0, 204
|
||||
)
|
||||
oreilly$col <- encode_colour(oreilly[c("r", "g", "b")])
|
||||
|
||||
tint <- function(col, tint) {
|
||||
n <- length(tint)
|
||||
col_Lab <- decode_colour(col, to = "Lab")
|
||||
white_Lab <- decode_colour(white, to = "Lab")
|
||||
|
||||
encode_colour(
|
||||
col_Lab[rep(1,n), ] * tint + white_Lab[rep(1,n), ] * (1 - tint),
|
||||
from = "Lab"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
tints <- seq(0.1, 1, length.out = 10)
|
||||
|
||||
oreilly |>
|
||||
group_by(name) |>
|
||||
summarise(
|
||||
tint = paste0("t", tints * 100),
|
||||
colour = tint(col, tints),
|
||||
.groups = "drop"
|
||||
) |>
|
||||
tidyr::pivot_wider(names_from = tint, values_from = colour)
|
||||
|
||||
scales::show_col(tint(oreilly$col[5], tints))
|