how to solve the axis the issues in chord diagram?

Recently I made some chord diagrams, one part of the diagram was column variables and other part of diagram was rows. i made several pictures using the code below, never had any problems but i don't know why i could not use in this data.

Data I am using

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))

code I applied to make chord diagram was

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()


my picture is plot 2. if you look at the data then bottom and surface are column variables and others in row. so in the diagram bottom and surface will be at constant and chord will be come from the row variables. how to solve this?

Can anyone please help?

in the question i cannot upload two picture so I upload it here. when i transpose my data then i can make picture like the below. but i want figure on the vice-versa, means same as the picture below but the chord will be originate from other variables not from "Bottom" and "Surface"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.