circlize
circlize copied to clipboard
Unable to plot bargraphs with unequal number of samples per sector
Hey,
I have been trying to use the following code to plot the columns from the data attached. I tried to create sectors the size of samples with the value in ANC column. However, it keeps giving the error: Note: 69 points are out of plotting region in sector 'NyNy', track '1'. We are not able to find help to solve this. Could you please help:
The code:
ROS <- read.csv("ROS.csv")
circos.initialize(factors=ROH$Ancestry_geography, x=ROH$INDV)
circos.trackPlotRegion( factors=ROH$Ancestry_geography, y=ROH$X100Kb,
panel.fun = function(x, y){
circos.axis()
})
set_track_gap(mm_h(2))
value=ROH$X100Kb
circos.barplot(value,0:22- 0.01)
Is this what you want?
tb = table(ROS$Ancestry)
circos.par(cell.padding = c(0, 1, 0.02, 1))
circos.initialize(sectors = names(tb), xlim = cbind(0, tb))
circos.track(ylim = c(0, max(ROS$X100Kb)), panel.fun = function(x, y) {
l = ROS$Ancestry == CELL_META$sector.index
x = ROS[l, "INDV"]
y = ROS[l, "X100Kb"]
circos.barplot(y, seq_along(x) - 0.5)
circos.text(seq_along(x) - 0.5, -uh(2, "mm"), x, facing = "clockwise", niceFacing = TRUE,
adj = c(1, 0.5))
circos.text(CELL_META$xcenter, CELL_META$cell.ylim[2] + uh(5, "mm"), CELL_META$sector.index)
})
circos.clear()
