Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R circlize chordDiagram how to improve image qualiity

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.

like image 476
Lamma Avatar asked Dec 02 '25 10:12

Lamma


1 Answers

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.

like image 112
Nitesh Shriwash Avatar answered Dec 04 '25 02:12

Nitesh Shriwash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!