avg_colors_by_list | R Documentation |
Average colors by list
avg_colors_by_list(
x,
useWeightedHue = TRUE,
Cmethod = c("mean", "max", "min"),
Lmethod = c("mean", "max", "min"),
c_min = 4,
grey_hue = 359,
...
)
x |
|
useWeightedHue |
logical indicating whether to weight the
hue wheel using |
... |
additional arguments are ignored. |
This is a simple wrapper function intended to provide a rapid average color, when supplied a list of color vectors in hex or R color name format.
This function simply converts each color to HCL, determines the
color hue angle (from 0 to 360) then calculates the average angular
color hue using avg_angles()
, then applies that to the maximum
C and L values to determine the new color. It is deliberately intended
to ignore muddiness when averaging multiple colors.
Colors are only modified for elements with 2 or more entries.
This method also only operates on the unique set of colors, so it should be substantially more efficient on large lists that contain only a few unique subsets of colors.
vector of R colors.
Other jam utility functions:
avg_angles()
,
call_fn_ellipsis_deprecated()
,
cell_fun_bivariate()
,
collapse_mem_clusters()
,
colorRamp2D()
,
deconcat_df2()
,
display_colorRamp2D()
,
enrichList2geneHitList()
,
filter_mem_genes()
,
filter_mem_sets()
,
find_colname()
,
get_igraph_layout()
,
gsubs()
,
handle_igraph_param_list()
,
isColorBlank()
,
make_legend_bivariate()
,
make_point_hull()
,
mem_find_overlap()
,
order_colors()
,
rank_mem_clusters()
,
rotate_coordinates()
,
subgraph_jam()
,
subset_mem()
,
summarize_node_spacing()
,
xyAngle()
x <- list(input1=c(red="red", blue="blue"),
input2=c(blue="blue", gold="gold"),
input3=c(red="red", yellow="yellow"));
x_avg <- avg_colors_by_list(x, useWeightedHue=TRUE);
jamba::showColors(list(
input1=c(x[[1]], x_avg[1]),
input2=c(x[[2]], x_avg[2]),
input2=c(x[[3]], x_avg[3])),
main="With weighted hue")
x_avg <- avg_colors_by_list(x, useWeightedHue=FALSE);
jamba::showColors(list(
input1=c(x[[1]], x_avg[1]),
input2=c(x[[2]], x_avg[2]),
input2=c(x[[3]], x_avg[3])),
main="Without weighted hue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.