我希望两个不同的嵌套分组变量的级别出现在图表下方的单独行中,而不是在图例中.我现在拥有的是这段代码:
data <- read.table(text = "Group Category Value
S1 A 73
S2 A 57
S1 B 7
S2 B 23
S1 C 51
S2 C 87", header = TRUE)
ggplot(data = data, aes(x = Category, y = Value, fill = Group)) +
geom_bar(position = 'dodge') +
geom_text(aes(label = paste(Value, "%")),
position = position_dodge(width = 0.9), vjust = -0.25)
Run Code Online (Sandbox Code Playgroud)

我想拥有的是这样的:

有任何想法吗?