How to fill incomplete axis lines in chord diagram?

56 Views Asked by At

In the migration example dataset with code provided at [https://www.data-to-viz.com/graph/chord.html], why in some objects, axis line does not extends beyond max values. For example, in South East Asia, Europe and West Asia, axis line is not complete, while some has complete axis line. chord diag

It appears like, axis line are covered through max value of objects where links begin, however, axis lines are either complete or partial where links end or connect other objects.

In another example axis line is mostly incomplete. chord diag

Is there a parameter in circlize to have complete axis lines where links meet objects? or is there a way to curtail axis line before links meet objects?

1

There are 1 best solutions below

0
Nitesh Shriwash On

You can manipulate the axis line using circos.axis() function when creating a chord diagram. I checked the code of the attached chord diagram for the migration example dataset, the problem is in the majar.at argument of the circos.axis() part.

The seq(from = 0, to = xlim[2], by = ifelse(test = xlim[2]>10, yes = 2, no = 1)) command generates one number less when the value of xlim[2] is above 10 and is odd.

like here:

xlim=get.cell.meta.dat("xlim")
xlim[2] = 11
seq(from=0, to=xlim[2], by = ifelse(test = xlim[2]>10, yes = 2, no = 1))
#[1]  0  2  4  6  8 10

You can see here that the seq() function generated digits from 0-10 instead of 0-11. This is the reason why the axis lines are smaller than they should be. You can modify this part and get your results. I would suggest you to use by = 1 in seq() function. This will generate all the points from 0 to 11.

seq(from=0, to=11, by=1 )
#[1]  0  1  2  3  4  5  6  7  8  9 10 11