【问题标题】:How solve the axis label for chord diagram in R?如何解决R中和弦图的轴标签?
【发布时间】:2022-07-07 11:39:02
【问题描述】:

最近我做了一些和弦图,图的一部分是列变量,另一部分是行。我用下面的代码做了几张照片,从来没有任何问题,但我不知道为什么我不能在这个数据中使用。

我正在使用的数据

data = structure(list(Sample = c("PP", "PP:PE", "PE", "PES", "PS", "Rayon", 
"Acrylic", "Resin", "Nylon", "PTFE", "PVA"), Bottom = c(110.625641, 
2.446153846, 14.58461538, 47.83589744, 1.774358974, 14.61538462, 
48.47692308, 0, 0, 0, 0), Surface = c(71.0974359, 4.112820513, 
5.487179487, 36.01025641, 1.087179487, 3.620512821, 30.62564103, 
0, 3.241025641, 0, 1.128205128)), class = "data.frame", row.names = c(NA, 
-11L))

我使用的代码是;

data = read.csv(file.choose(), row.names = 1)


data <- as.matrix(data)


col = c( 'PP' = "#8601af", 'PP:PE'  = "blue", 'PE' = "Cyan", 'PES' = "springgreen", 'PS' = "yellow", 'Rayon' = "darkorange", 'Acrylic' = "red", 'Resin' = "darkslateblue", 'Nylon' = "deepskyblue1", 'PTFE' = "darkgreen", 'PVA' = "orchid1", 'Bottom' = "grey 35", 'Surface' = "grey 71")

chordDiagram(data, grid.col = col, annotationTrack = "grid", preAllocateTracks = 1)

circos.trackPlotRegion(track.index = 2, panel.fun = function(x, y) {
  xlim = get.cell.meta.data("xlim")
  ylim = get.cell.meta.data("ylim")
  sector.name = get.cell.meta.data("sector.index")
  circos.text(mean(xlim), ylim[1] + 2.5, sector.name, 
              facing = "clockwise", niceFacing = TRUE, adj = c(0, 0.5), cex=0.7)
  circos.axis(h = "top", labels.cex = 0.7, major.tick.percentage = 0.2,
              sector.index = sector.name, track.index = 2)
}, bg.border = NA)

dev.copy(jpeg,'S.B-FTIR.tiff', width=8, height=8, units="in", res=500)
dev.off()

但我的图表是这样的

它应该会弹出下面的图片,其中底部和表面应该在一侧,其他参数在另一侧。

【问题讨论】:

    标签: r axis-labels chord-diagram


    【解决方案1】:

    我遇到了同样的问题,这是我的解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-16
      • 2017-11-03
      • 1970-01-01
      • 2015-03-13
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 2011-01-27
      相关资源
      最近更新 更多