jokergoo / circlize

Circular visualization in R
http://jokergoo.github.io/circlize_book/book/
Other
959 stars 141 forks source link

`circos.labels` tracks defined by `chordDiagram`'s preAllocateTrack! #371

Open m3hdad opened 1 year ago

m3hdad commented 1 year ago

Thanks for the great work here,

I was wondering if circos.labels() could read preAllocated tracks from chordDiagram. In the example you showed if the side is outside, we need to first set 2 tracks created by circos.labels() and then initiate other tracks.

I believe it would be a great feature if we could tell circos.labels() to assign tracks to those preallocated by chordDiagram(). Or maybe there is already a solution for this and I can't see it.

For now I'm just using circos.text to set my labels and I'm missing on features in circos.labels. Thanks,

par(mfrow = c(1, 2))
circos.initialize(sectors = letters[1:8], xlim = c(0, 1))
circos.track(ylim = c(0, 1))
circos.labels(c("a", "a", "b", "b"), x = c(0.1, 0.12, 0.4, 0.6), labels = c(0.1, 0.12, 0.4, 0.6))
circos.clear()

circos.initialize(sectors = letters[1:8], xlim = c(0, 1))
circos.labels(c("a", "a", "b", "b"), x = c(0.1, 0.12, 0.4, 0.6), labels = c(0.1, 0.12, 0.4, 0.6),
    side = "outside")
circos.track(ylim = c(0, 1))