chordDiagram function, R package circlize
Asked Answered
C

2

5

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?

Circumgyration answered 2/4, 2015 at 17:35 Comment(0)
K
3

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.

Keneth answered 3/4, 2015 at 2:24 Comment(1)
vignettes link is broken. Have a look at the book zuguang.de/circlize_book/bookHaemolysis
C
6

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)
Champlain answered 2/4, 2015 at 17:41 Comment(0)
K
3

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.

Keneth answered 3/4, 2015 at 2:24 Comment(1)
vignettes link is broken. Have a look at the book zuguang.de/circlize_book/bookHaemolysis

© 2022 - 2024 — McMap. All rights reserved.