In R, circular plots are made using the circlize library. Here is a really basic utilisation. You must understand these few steps before going further with more sophisticated charts. Circular plots are composed by several **regions **(8 here), each representing a level of a **factor**. Always follow these 3 steps to build a circular plot:

**Step 1:**Initialize the chart with**circos.initialize**. Provide the factor vector, and the numeric values to use for the X axis. The circle will be split in as many zone as the number of levels present in your factor. Each region will be as long as the coresponding x axis.**Step2:**Build the regions with**circos.trackPlotRegion**. You have to specify the factors once again, and tell what to use for the Y axis if needed. (left hand side figure)**Step3:**Add a chart in each region using for example the**circos.trackPoints**function. Note that you can use other type of plots (see graph #xx). (right hand side figure)

Then you can check how to custom the graph, add another track or plot links between regions!

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# Upload library library(circlize) # Create data data = data.frame( factor = sample(letters[1:8], 1000, replace = TRUE), x = rnorm(1000), y = runif(1000) ) # Step1: Initialise the chart giving factor and x-axis. circos.initialize( factors=data$factor, x=data$x ) # Step 2: Build the regions. circos.trackPlotRegion(factors = data$factor, y = data$y, panel.fun = function(x, y) { circos.axis() }) # Step 3: Add points circos.trackPoints(data$factor, data$x, data$y, col = "blue", pch = 16, cex = 0.5) |

Not what you are looking for ? Make a new search !

`[mediatagger]`

## Leave a Reply