chordDiagram function, R package circlize

2019-02-23 08:56发布

问题:

Can anyone tell me how I can change the labels size in chordDiagram function (R package circlize)? I looked for an option like cex or cex.labels but cannot seem to find one. Also, Can the orientation be changed?

回答1:

As lukeA said, setting par() is the most straightforward way to change basic font settings. chordDiagram() only provides default style for the text, the reason is there are so many different styles for the labels (e.g. font size, direction, position, only drawn in subset of sectors...). If the function supports them all, the function will be very heavy.

But chordDiagram() also provides an 'advanced' solution to self-define everything in the circle. I.e. first allocate empty space for the graphics (e.g. labels) and then add the graphics afterwards by self-defined codes.

You may refer to figure 10 in the vignette (http://cran.r-project.org/web/packages/circlize/vignettes/circular_visualization_of_matrix.pdf) There are examples and code to set the orientation of labels.



回答2:

You could change the global par settings before plotting:

library(circlize)
mat = matrix(sample(1:100, 18, replace = TRUE), 3, 6)
rownames(mat) = letters[1:3]
colnames(mat) = LETTERS[1:6]
par(cex = 2, mar = c(0, 0, 0, 0))
chordDiagram(mat)


标签: r circlize