3

I am attempting to make a chord diagram of a fairly large 18*65 table (not every cell has a value).

I have generated the image I want but the quallity of it is nothing like what is shown on the github seen below: a

I figure maybe the number of cells needing to be plotted may cause problems but otherwise I am not sure why i get such a difference:

circos.par(gap.after = c(rep(2, ncol(chord_data)-1), 10, rep(2, 8-1), 5, rep(2, 10-1), 5, rep(2, 5-1), 5, rep(2, 3-1), 5, rep(2, 1), 5, rep(2, 12-1), 5, rep(2, 10-1), 5, rep(2, 6-1), 5, rep(2, 7-1), rep(2, 3-1), 10))

    png(file = "antismash_by_type.png", width = 800, height = 800)
    chordDiagram(chord_data,
                 grid.col = grid.col,
                 order = order, 
                 annotationTrack = "grid",
                 preAllocateTracks = 1)

    circos.track(track.index = 1, panel.fun = function(x, y) {
      circos.text(CELL_META$xcenter, CELL_META$ylim[1], CELL_META$sector.index, 
                  facing = "clockwise", niceFacing = TRUE, adj = c(0, 0.5))
    }, bg.border = NA)
    dev.off()

b

Secondly my chords do not appear to be scaling to the value of the cell which ranges from 0-100 and from what I read this is meant to occure by default but does not appear to be.

RMM
  • 313
  • 2
  • 11
  • For the first question, try a pdf() output device, or a larger png. Depending on your system, different underlying rendering engines have different outputs, including what anti-aliasing support they offer, so changing other parameters to png() may improve things. – Stuart R. Jefferys Jun 17 '20 at 16:36
  • I am also having the same issue. The chord diagram on "circlize" website looks awesome, while it is very pixelated on my RStudio. Hopefully, someone will respond with a solution to improve the resolution. – Riq Jun 06 '23 at 19:36

1 Answers1

0

You can use res argument in png() function to improve image quality.

png('image.png', height = 37*350, width = 40*350, res=600 )

You can adjust the height and width according to the image size. You should provide some reproducible data for scaling chords.

Nitesh Shriwash
  • 128
  • 1
  • 6