我试图在一个图表中混合使用堆叠和非堆叠条形图。
下面是示例代码:
Indicators <- c("Z","X","C","NO C","NA C","LOW C","HIGH C","D","E","F","G","H","LOW H","MED H","HIGH H",
"I","LOW I","MED I","HIGH I","J","LOW J","MED J","HIGH J")
Class_1 <- c(0.44,0.01,"",0.6,0.13,0.11,0.16,0.08,0.01,0.14,0.21,"",0.55,
0.23,0.22,"",0.4,0.31,0.29,"",0.41,0.23,0.36)
data <- data.frame(Indicators,Class_1)
我怎样才能制作一个既有非堆叠条形图又有堆叠条形图的图表呢?我真的很感激所有的帮助!谢谢!
2条答案
按热度按时间k97glaaz1#
基本上你想要一个堆叠条形图,即使对于某些类别没有什么可堆叠的。为此,你必须做一些数据的处理和清理,比如去掉空值行,并将
Indicators
列一分为二:brtdzjyr2#
更新II:
更新:(@camille是对的,我现在修改了我的答案,删除了第一个)