我不是很確定,如果您的描述所需的情節是不含糊。
我的解釋是以下幾點:
## Copied from user1317221_G - Thanks for that.
babydf <- structure(list(ALL = c(2016L, 154L, 116L), Critical = c(1412L,
45L, 86L), Error = c(475L, 49L, 12L), Warning = c(4L, 2L, 1L),
Review = c(125L, 58L, 17L)), .Names = c("ALL", "Critical",
"Error", "Warning", "Review"), class = "data.frame", row.names = c(NA,
-3L))
# Add IDs
babydf <- cbind(id=1:nrow(babydf), babydf))
library(reshape2)
library(ggplot2)
# reshape the dataframe:
df.reshaped <- melt(babydf, id.vars='id')
ggplot(subset(df.reshaped, variable != 'ALL'), aes(x=id, y=value, fill=variable)) + geom_bar(stat='identity')
![enter image description here](https://i.stack.imgur.com/ALQh0.jpg)
如果你想有相同高度的所有酒吧,只是做
babydf[, 3:6] <- babydf[, 3:6]/babydf$ALL * 100
melt
之前。結果: ![enter image description here](https://i.stack.imgur.com/jJKC8.jpg)
謝謝..它的工作有所延伸。但我想在Y軸的百分比而不是計數。謝謝 –
嗯,我的第二個圖上的位置究竟在哪裏?我一直認爲所有100的酒吧應該是百分之百。 – Thilo
對不起,我沒有注意到..非常感謝你。一個更多的幫助將不勝感激。實際上實際的數據集是這樣的。[https://dl.dropboxusercontent.com/u/93667882/issue_data.csv。我想爲每個BU明智的國家明智和司明智。我有問題需要prepossessing數據以適應ggplot2需求。幫助,將不勝感激。@ Thilo –