Description Usage Arguments Examples
This function is used for getting hard clusters by cutting a tree. Use function plot_colours
on the result of this function to get a plot.
1 | tree2color(tree_model, k = 3, fun = "mean")
|
tree_model |
model produced by |
k |
number of clusters. |
fun |
function used on grouped data. Perhaps it makes sense to use different functions than mean. Median might be a good choice. Input should be character. |
1 2 3 4 5 6 7 8 9 | path <- "./man/figures/duck.jpg"
tree <- pick_palette_jk(path)
colours <- tree2color(tree, k = 10)
plot_colours(colours)
## or use something like this
# it is commented in order not to fail when pals is unable to install
# color_list <- purrr::map(1:10,~tree2color(tree,.x))
#do.call(pals::pal.bands,color_list)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.