Redrawing join diagrams

This commit is contained in:
Hadley Wickham 2022-08-30 08:11:25 -05:00
parent edf0d5436f
commit 47607389c1
10 changed files with 38 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 54 KiB

38
oreilly-colours.R Normal file
View File

@ -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))