0

I would like to plot pairwise inter-relationships between numerical data points in the style of a mixed circular scatterplot and a chord diagram.

In contrast to a "real" chord diagram, I only have a single sector with pairs of circular continuous values that represent different times of the day (0-24 h) that are assigned to different categorical groups:

> time1 <- c(4.85, 6.44, 15.45, 12.53, 5.24, 16.05)
> time2 <- c(16.78, 18.26, 5.94, 7.11, 15.45, 5.07)
> group <- c("A", "C", "D", "B", "A", "D")
> time_df <- cbind.data.frame(group, time1, time2)
> time_df
  group time1 time2
1     A  4.85 16.78
2     C  6.44 18.26
3     D 15.45  5.94
4     B 12.53  7.11
5     A  5.24 15.45
6     D 16.05  5.07

There should be a line between each of these time points that is colored according to the group the pair is assigned to. I tried using the chordDiagram() function from the R package circlize to realize this but soon noticed that it is mostly used for relationships between categorical data.

Do you know of another R package that could be used for this kind of visualization or can it be done using circlize::chordDiagram() after all?

atreju
  • 965
  • 6
  • 15
  • 36

1 Answers1

0

If I understand it correctly, you can force to think time as a factor and it has two levels. Then the actual time values will be the links between Group and Time.

Although, I think it might be better if you just do a barplotin ggplot, and use two different colors to indicate the time1 and time2. So in that way, it's side by side and easier to compare, just my two cents.

timxymo1225
  • 481
  • 1
  • 4
  • 13