I am trying to input this dataframe into a circular format using the package "circlize"
dataframe:
Value Location
1 22.64237 Front
2 12.53842 Left
3 70.00000 Center
4 39.83154 Right
5 13.22489 Rear
I'd like each "Value" to be visualised as a bar (barplot) and I'd like there to be one bar per cell so that there is one Location per sector. Unfortunately, I am having some difficulty understanding how to do this.
So far my code looks like this and I'm not quite sure where I am going wrong:
library(circlize)
circos.clear()
circos.par("clock.wise" = FALSE, start.degree = 20, gap.degree = 8)
set_track_gap(gap = 0.2)
circos.initialize(sectors = sample_df$Location, xlim = c(0,5))
circos.track(ylim = c(0,100), panel.fun = function(x,y) {
value = sample_df$Value
circos.barplot(value[1], 1 -0.5,
sector.index = "Front")
circos.barplot(value[2], 1 -0.5,
sector.index = "Left")
circos.barplot(value[3], 1 -0.5,
sector.index = "Center")
circos.barplot(value[4], 1 -0.5,
sector.index = "Right")
circos.barplot(value[5], 1 -0.5,
sector.index = "Rear")
})
Any help would be hugely appreciated!!! Thanks very much.