我想使用这个circlize
包制作一个 RGB 配色方案。首先,我尝试制作一个函数,这样我只需要输入颜色和扇区,该函数就可以完成这项工作
这是代码:
colorpallete <- function(color, x){
draw.sector(get.cell.meta.data("cell.start.degree", sector.index = x),
get.cell.meta.data("cell.end.degree", sector.index = x),
rou1 = get.cell.meta.data("cell.top.radius", track.index = 1),
rou2 = get.cell.meta.data('cell.bottom.radius', track.index = 3),
col = adjustcolor(col = color, alpha.f = 0.2))
draw.sector(get.cell.meta.data("cell.start.degree", sector.index = x),
get.cell.meta.data("cell.end.degree", sector.index = x),
rou1 = get.cell.meta.data("cell.top.radius", track.index = 1),
rou2 = get.cell.meta.data('cell.bottom.radius', track.index = 2),
col = adjustcolor(col = color, alpha.f = 0.2))
draw.sector(get.cell.meta.data("cell.start.degree", sector.index = x),
get.cell.meta.data("cell.end.degree", sector.index = x),
rou1 = get.cell.meta.data("cell.top.radius", track.index = 1),
rou2 = get.cell.meta.data('cell.bottom.radius', track.index = 1),
col = adjustcolor(col = color, alpha.f = 0.2))
}
circos.initialize(sectors, xlim = c(0, 1))
for(i in 1:3) {
circos.track(ylim = c(0, 1))
}
colset = (c('blue', 'cyan', 'green', 'yellow', 'red', 'violet'))
sectors = letters[1:6]
colorpallete(colset, sectors)
当我尝试运行代码时,它返回以下错误:
Error: Length of `sector.index` should only be 1.
如何使函数对应每个列表,例如当我调用函数时,只调用'blue'和'a',然后调用'cyan'和'b'等。
非常感谢您提前