Debian Codegraph @

R/rainbow_fun.R

raw
1 # Copyright (C) Tal Galili
2 #
3 # This file is part of dendextend.
4 #
5 # dendextend is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # dendextend is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # A copy of the GNU General Public License is available at
16 # http://www.r-project.org/Licenses/
17 #
18
19 # An internal function to create rainbows:
20
21 rainbow_fun <- function(n, c = 90, l = 50, ...) {
22 if (requireNamespace("colorspace")) {
23 colorspace::rainbow_hcl(n, c = c, l = l, ...)
24 } else {
25 rainbow(n, ...)
26 }
27 }
28
29 # n = 10
30 # barplot(rep(10, n), col = rainbow_hcl(n) )
31 # barplot(rep(10, n), col = rainbow_hcl(n, c=90, l=50) )