jokergoo / circlize

Circular visualization in R
http://jokergoo.github.io/circlize_book/book/
Other
959 stars 141 forks source link

Error: not enough space for calls at track index #377

Open evoJDG opened 1 year ago

evoJDG commented 1 year ago

Hello. Love the package, it makes beautiful plots.

I saw that this error was previously addressed in issue #260 but the advice does not solve it for me.

I am trying to plot the position of genes on multiple chromosomes. I am currently looping through each chromosome using circos.genomicTrackPlotRegion and to set the region and circos.lines to add the lines. I have >6000 genes in total on 29 chromosomes.

It produces the error Error: not enough space for cells at track index '9'. The index number where it breaks depends on the number and size of the chromosomes. I guess this is to do with the number of lines not fitting in the space for a cell, but reducing the track height does not work, even if it is so small (0.01) that the lines are not really useful. I have tried various combinations of y values, y limits and track heights, but can't find one that plots successfully. Do you have any suggestions?

Thanks. James

Code:

YLIM=1

circos.clear() circos.initializeWithIdeogram(df_plot)

loop through

for (i in unique(df_plot$shrt_chrom) ) {

subset for each chromosome

df <- df_plot[ , ] %>% filter(shrt_chrom == i)

add tracks

circos.genomicTrackPlotRegion(df, ylim = c(0, YLIM), bg.border = NA, track.height = 0.1, # have tried various heights, even 0.01 does not work panel.fun = function(region, value, ...) { col = value$colour # specified in df circos.lines(x = df$start, y=df$y, type = 'h', col = "grey", sector.index = i, track.index = 2 ) }, cell.padding = c(0, 0, 0, 0) )

Sample data attached. Let me know if you need more to recreate the error.

Circlize_Question_SampleData.xlsx