plot_paleta | R Documentation |
Plot color palette from color distribution data
plot_paleta(
color_data,
method = c("treemap", "tiles", "bars", "spectrum"),
sort_by = c("distribution", "hue", "luminance", "saturation", "temperature", "harmony",
"lab", "similarity", "category", "gradient", "none"),
reverse = FALSE,
label_colors = TRUE,
nrow = NULL,
reference_color = "#FF5500"
)
color_data |
A tibble with at least 'color' column; optionally 'distribution' for size weighting. Alternatively, a character vector of colors. |
method |
Visualization method: "treemap", "tiles", "bars", or "spectrum" |
sort_by |
How to sort colors: "distribution" (default), "hue", "luminance", "saturation", "temperature", "harmony", "lab", "similarity", "category", "gradient", or "none" |
reverse |
Logical. Whether to reverse the sort order (default: FALSE) |
label_colors |
Logical. Whether to add color hex codes as labels (default: TRUE) |
nrow |
Number of rows for "tiles" method (default: NULL for auto calculation) |
reference_color |
Reference color for "similarity" sorting (default: "#FF5500") |
A ggplot object showing the color palette
# With a tibble input
colors_data <- tibble::tibble(
color = c("#FF0000", "#00FF00", "#0000FF"),
distribution = c(0.5, 0.3, 0.2)
)
plot_paleta(colors_data, method = "treemap")
# With a vector input
colors_vec <- c("#FF0000", "#00FF00", "#0000FF")
plot_paleta(colors_vec, method = "tiles")
# Sort by different methods
plot_paleta(colors_vec, method = "spectrum", sort_by = "luminance")
plot_paleta(colors_vec, method = "spectrum", sort_by = "temperature")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.