bernatgel / karyoploteR

karyoploteR - An R/Bioconductor package to plot arbitrary data along the genome
https://bernatgel.github.io/karyoploter_tutorial/
295 stars 42 forks source link

Overlapping labels and huge gap between them #145

Open scienception opened 1 year ago

scienception commented 1 year ago

I added label.dist=0.0000001 with the hope it would bring labels together but didn't happen. Is this a bug? Not only are they too spaced out, but they overlap with other regions. Is there a way to raise the bar upper just for one group? So that they don't overlap with the other?

png(paste0("CNVs.png"), width = 400, height = 400, units='mm', res = 300)
plot.params <- getDefaultPlotParams(plot.type=1)
plot.params$data1height <- 100000
kp <- plotKaryotype(chromosomes=c("autosomal"), plot.type = 1)
kpPoints(kp, chr = num, x=in_df$chr_position, y=0.15, col="red", cex=0.2)
chr_names <- noquote(paste0(rep("chr", length(cnv_signals_df$chr)), cnv_signals_df$chr))
CNVR <- toGRanges(data.frame(chr=chr_names, start=cnv_signals_df$start, end=cnv_signals_df$end))
kpPlotRegions(kp, CNVR,col="#FFAACC")
middle_points <- round(cnv_signals_df$start+(cnv_signals_df$end-cnv_signals_df$start)/2)
kpPlotMarkers(kp, chr=chr_names, x=middle_points, labels=cnv_signals_df$pheno, r1 = 0.3, cex=0.4, text.orientation = "vertical", label.color="black",ignore.chromosome.ends=TRUE,max.iter=1000,abel.dist=0.0000001)   
dev.off()

CNVs

h20gg702 commented 3 months ago

Did you find a good solution for this? I have a same problem too.