Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chordDiagram function, R package circlize

Tags:

r

circlize

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?

like image 716
Al14 Avatar asked Apr 02 '15 17:04

Al14


2 Answers

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)
like image 65
lukeA Avatar answered Oct 30 '22 03:10

lukeA


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.

like image 37
Zuguang Gu Avatar answered Oct 30 '22 03:10

Zuguang Gu