show_col2 | R Documentation |
Creates a grid visualization of multiple color palettes using ggplot2. Each palette is displayed as a row of colored tiles with white borders, making it easy to compare different color schemes or visualize multiple variations of a palette.
show_col2(palette_list, ncol)
palette_list |
A named list of color palettes. Each element should be a character vector of colors (hex codes or color names). |
ncol |
Integer specifying the number of columns in the grid. Determines how many colors are displayed per row before wrapping. |
The function is particularly useful for visualizing: - Different variations of color_pro() outputs - Multiple color schemes side by side - Comparisons between different palette generation methods Each row is labeled with the name from the input list, and colors are displayed as tiles with white borders for clear separation.
A ggplot object displaying the color palettes in a grid format.
## Not run:
library(SeuratExtend)
# Example 1: Compare different numbers of colors
palette_list <- list(
"n=2" = color_pro(2),
"n=5" = color_pro(5),
"n=10" = color_pro(10),
"n=20" = color_pro(20)
)
show_col2(palette_list, ncol = 20)
# Example 2: Compare different color schemes
palette_list <- list(
"default" = color_pro(10, 1),
"light" = color_pro(10, 2),
"red" = color_pro(10, 3),
"yellow" = color_pro(10, 4),
"green" = color_pro(10, 5),
"blue" = color_pro(10, 6),
"purple" = color_pro(10, 7)
)
show_col2(palette_list, ncol = 10)
# Example 3: Compare different sorting methods
palette_list <- list(
"sort_hue" = color_pro(10, 1, sort = "hue"),
"sort_diff" = color_pro(10, 1, sort = "diff")
)
show_col2(palette_list, ncol = 10)
# Example 4: Compare different random sets
palette_list <- list(
"Set1" = color_pro(10, 1, 1, 1),
"Set2" = color_pro(10, 1, 1, 2),
"Set3" = color_pro(10, 1, 1, 3),
"Set4" = color_pro(10, 1, 1, 4),
"Set5" = color_pro(10, 1, 1, 5)
)
show_col2(palette_list, ncol = 10)
# Example 5: Compare color_iwh styles
palette_list <- list(
"default" = color_iwh(10, 1),
"intense" = color_iwh(10, 2),
"pastel" = color_iwh(10, 3),
"all" = color_iwh(10, 4),
"all_hard" = color_iwh(30, 5)
)
show_col2(palette_list, ncol = 10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.