Circular plots are highly useful to visualize relationship between elements, like to show migration flow. The connections are drawn using the circos.link function. This function takes as input the origin and the destination of the link (element name, and zone of this element). You can custom the appearance of the link using lwd (thickness of border), lty (type of border), col (color), border (true or false) and h (shape of the link).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# library library(circlize) # Create data set.seed(123) data = data.frame( factor = sample(letters[1:8], 1000, replace = TRUE), x = rnorm(1000), y = runif(1000) ) # Initialize the plot. par(mar = c(1, 1, 1, 1) ) circos.initialize(factors = data$factor, x = data$x ) # Build the regions of track #1 circos.trackPlotRegion(factors = data$factor, y=data$y , bg.col = rgb(0.1,0.1,seq(0,1,0.1),0.4) , bg.border = NA) # Add a link between a point and another circos.link("a", 0, "b", 0, h = 0.4) # Add a link between a point and a zone circos.link("e", 0, "g", c(-1,1), col = "green", lwd = 2, lty = 2, border="black" ) # Add a link between a zone and another circos.link("c", c(-0.5, 0.5), "d", c(-0.5,0.5), col = "red", border = "blue", h = 0.2) |
Not what you are looking for ? Make a new search ![mediatagger]
Leave a Reply
Be the First to Comment!