show_color_distance | R Documentation |
Show color distance as a heatmap
show_color_distance(
cd = NULL,
pc = NULL,
show_labels = TRUE,
cluster_data = FALSE,
row_split = 0,
...
)
cd |
|
pc |
|
show_labels |
|
cluster_data |
|
row_split |
|
... |
additional arguments are passed to |
This function uses ComplexHeatmap::Heatmap()
, which is not
required for colorjam as a whole. It creates a matrix visual
summary of color distances, and displays the actual colors as
row and column annotations outside the color distance
heatmap.
ComplexHeatmap::Heatmap
object, when printed it will
draw a heatmap.
pc <- grDevices::palette.colors(25);
cd <- color_distance(pc, method="cie2000");
show_color_distance(cd, pc)
# with clustering
show_color_distance(cd, pc, cluster_data=TRUE,
column_title_gp=grid::gpar(fontsize=20),
column_title="palette.colors()")
# compare two color vectors
pc1 <- rainbowJam(10, preset="ryb2")
pc2 <- colorspace::rainbow_hcl(10)
cd <- color_distance(pc1, pc2)
show_color_distance(cd, cluster_data=TRUE,
row_title_rot=90, row_title="rainbowJam()",
row_title_gp=grid::gpar(fontsize=20),
column_title_gp=grid::gpar(fontsize=20),
column_title_rot=0, column_title="rainbow_hcl()")
# evaluate the small step size between HCL rainbow colors
show_color_distance(pc2,
column_title_gp=grid::gpar(fontsize=20),
column_title_rot=0, column_title="rainbow_hcl()")
# evaluate the larger step sizes between colorjam rainbow colors
show_color_distance(pc1, cluster_data=FALSE,
column_title_gp=grid::gpar(fontsize=20),
column_title_rot=0, column_title="rainbowJam()")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.