【问题标题】:find center and add text to the circos plot找到中心并将文本添加到马戏团情节
【发布时间】:2017-12-17 06:23:37
【问题描述】:

圆心(a,b)可以由圆方程导出

<a href="http://www.codecogs.com/eqnedit.php?latex=\inline&space;(x-a)^2+(y-b)^2&space;=&space;r^2" target="_blank"><img src="http://latex.codecogs.com/gif.latex?\inline&space;(x-a)^2+(y-b)^2&space;=&space;r^2" title="(x-a)^2+(y-b)^2 = r^2" /></a>

如何找到圆图的中心并在圆图的中心插入文本?

library(circlize)
df10 <- data.frame( from = c("aaa", letters[2:6]), 
                    to = c(letters[2:6], "aaa"))


grid.col = c(aaa = "red", b = "green", c = "blue",
             d = "grey", e = "grey", f = "grey")
sector_order <- c("aaa", "b", "c", "d", "e", "f")

chordDiagram(x = df10,
             preAllocateTracks = list(list(track.height = max(strwidth(c(df10$from, df10$to))))),
             grid.col = grid.col,
             annotationTrack = c("grid"),
             link.lwd = 2,
             col = 1:6,
             link.border =1:6,
             link.lty = 1,
             order = sector_order)

# rotate sector label
circos.track(track.index = 1, panel.fun = function(x, y) {
  circos.text(CELL_META$xcenter, CELL_META$ylim[1], CELL_META$sector.index, 
              facing = "clockwise", niceFacing = TRUE, adj = c(0, 0.5),
              cex = 3)
}, bg.border = NA) # here set bg.border to NA is important

circos.clear()

【问题讨论】:

    标签: r circlize


    【解决方案1】:

    中心在 (0,0),所以你可以这样做:

    text(0,0,"Text here")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-17
      • 1970-01-01
      • 2017-05-26
      • 1970-01-01
      • 1970-01-01
      • 2018-06-11
      相关资源
      最近更新 更多