【发布时间】:2021-07-27 13:46:28
【问题描述】:
我想使用 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'等
非常感谢您
【问题讨论】:
标签: r data-visualization circlize