简体   繁体   English

在堆积条形图中,如何绘制每个条形从 x 轴开始的变量(垂直)不同类别的条形?

[英]In a stacked bar plot,How do u plot bars of different categories of a variable (vertically) where every bar starts from x-axis?

http://www.bing.com/images/search?q=stacked+bar+chart&view=detailv2&id=CD8EFAE719BFA5FCA1AB1EA6DAA22363E76EAD13&selectedindex=1&ccid=lTsHf2uz&simid=608041385567914091&thid=OIP.M953b077f6bb366647d008eda5ec12aa7H0&mode=overlay&first=1

In the above picture, In match 9 team A scores 400 ( on score axis : 0-400), team B scores 90 (on score axis : 400-490) , team C scores 410 (490-900)在上图中,在第 9 场比赛中,A 队得分 400(得分轴:0-400),B 队得分 90(得分轴:400-490),C 队得分 410(490-900)

What should I do to get a bar diagram where I have all three teams scores bars starting from x axis for every match?我应该怎么做才能得到一个条形图,其中每场比赛的所有三支球队的得分条都从 x 轴开始? (Bars of lower frequencies should be visible without being superimposed by high frequency ones) (低频条应该是可见的,而不是与高频条叠加)

like team A scores 400 ( on score axis : 0-400), team B scores 90 (on score axis : 0-90) , team C scores 410 (0-410)例如 A 队得分 400(得分轴:0-400),B 队得分 90(得分轴:0-90),C 队得分 410(0-410)

Solution in R or excel is required需要 R 或 excel 中的解决方案

The best visualization solution for this lies in rCharts package最好的可视化解决方案在于 rCharts 包

library(rCharts)图书馆(rCharts)

n1 <- nPlot(score ~ Match, group = "Team", data = player, type = "multiBarChart") n1 <- nPlot(score ~ Match, group = "Team", data = player, type = "multiBarChart")
n1 n1

If you want to publish on github, you can also do如果你想在github上发布,你也可以这样做

n1$publish("Player", host = 'gist') n1$publish("玩家", host = 'gist')

If you want to save as html如果要另存为 html

n1$save("Player.html") n1$save("Player.html")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM