circlize icon indicating copy to clipboard operation
circlize copied to clipboard

About the line type in function circos.segments

Open nzx9581 opened this issue 2 years ago • 1 comments

Hi Dr. Gu,

Thank you so much for providing us with this brilliant package. And now I have two questions, one for the line types in the function circos.segments, and another for the label position of the function circos.text

  1. In the function circos.segments, I set the line type as lty=3 which is dashed line, and everything goes well, with no errors and no warnings, the dashed line is shown correctly in the Plots window of rstudio-server. But when I export the figure as png by CairoPNG, the dashed line just becomes solid.
circos.track(ylim=c(0,15),track.margin= c(0,0),cell.padding=c(0,1,0,1),bg.border=NA,track.height= 0.15,
             panel.fun = function(x,y){
               #circos.lines(x=gene.TPM$start,y=rowMeans(gene.TPM[,c(1:3)]),type = 'h')
               circos.rect(gene.TPM$start,rep(0,nrow(gene.TPM)),gene.TPM$end,rowMeans(gene.TPM[,c(1:3)]),
                           border=NA,col='lightblue')
               circos.segments(0,0,1339720,0)
               circos.yaxis(side = 'left',labels.niceFacing = F,at = c(4,8,12),col='#40434E')
               circos.segments(0,4,1339720,4,col = 'gray',lty = 3)
               circos.segments(0,8,1339720,8,col='gray',lty = 3)
               circos.segments(0,12,1339720,12,col='gray',lty=3)
             })
  1. In the function circos.text, there are two labels that I want to add to the figure. And the position of these two labels is perfectly fixed. Like question 1, the label is also greatly plotted to the figure. However, the position of these two labels in the exported png file shifts to the wrong place.
circos.track(ylim=c(0,1),track.height=0.05,track.margin=c(0,0),cell.padding=c(0,1,0,1),bg.border=NA,
             panel.fun=function(x,y){
               circos.rect(wo.phage$region.x,c(0,0),wo.phage$region.y,c(1,1),col=wo.phage$color,border=NA)
               circos.text(CELL_META$xcenter+cm_x(5.3),CELL_META$ycenter,labels = 'WO-A',col = '#40434E')
               circos.text(CELL_META$xcenter+cm_x(8.5),CELL_META$ycenter,labels = 'WO-B',col = '#40434E')
             })

The plot in the plot region of rstudio-server (looks good) there are dashed line (red), and correct label positions (blue) image

The exported png file dashed lines become solid (red), and the label position are shifted (blue) image

Thanks for helping me to solve this problem, much appreciate!

Best, Zhixin

nzx9581 avatar Aug 10 '22 21:08 nzx9581

  1. What if directly saving by png() function or pdf() function?
  2. This is very strange. Can you share the complete data and code with me so that I can test it on my laptop?

jokergoo avatar Sep 01 '22 14:09 jokergoo