I am trying to produce a modified version of a Chord Diagram in R using the chordDiagram()
function in the circlize
package in R.
Suppose we have this toy example (as for the documentation of the package):
require(circlize)
df = expand.grid(letters[1:3], LETTERS[1:4])
df$value = 1
df$value2 = 3
chordDiagram(df[, 1:3])
The output will be pretty straightforward:
Now, the problem is: let's suppose that I need to make two "ends" overlap to represent an intersection, for example, the ribbon going from b-->A and the ribbon going from a-->A, so that they end in the same sector "merging" each other (such as in the figure below).
Is that possible? I didn't find any example in the documentation nor I was able to perform this task by tweaking the options.
Hope that I made myself clear. Thank you for any try.
If I understand you correctly, you want to make overlapping parts in the diagram. So for example
S3 -> E2
andS2 -> E2
. You create a matrix which has a format so that you get overlapping paths in the diagram. I will give you an example with the following code:First create a matrix with connection between S and E with different values:
Next create a dataframe which has a format of columns with character from to another character with values to check what the patterns are more easily:
Plot the output using
mat
:As you can see, there is some overlap in the paths of
S3 -> E2
andS2 -> E2
.