使用matplotlib创建带有2轴轴的条形图
我需要列出以下图表:公司数量,捐款与年度图表。
以下是我的数据:
Year = [2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018]
No_Companies = [123558,132335,147606,155790,161211,169784,174599,183888,198727,207317,217357,228996]
Donations=[144932,304607,642328,870509,1205382,1094624,2089240,2325322,2387036,3096069,4204255,3500766]
从我从其他问题中看到的内容,大多数似乎在数据框架或[[x1,y1],[x2,y2]]
之类的列表中都有其数据。
如何从数据中获取所需的图表?
I need to make the following chart: Number of Companies, Donations vs Year as a bar chart.
The following is my data:
Year = [2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018]
No_Companies = [123558,132335,147606,155790,161211,169784,174599,183888,198727,207317,217357,228996]
Donations=[144932,304607,642328,870509,1205382,1094624,2089240,2325322,2387036,3096069,4204255,3500766]
From what I have seen from other questions, most seem to have either their data in a dataframe or a list like [[x1,y1],[x2,y2]]
.
How can I get the chart I need from the data I have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以检查此链接:在同一地块中的绘图条和线路,使用matplotlib(无熊猫)的不同y轴
可以按以下方式完成实现:
Graph
You can check this link out: Plot bar and line in same plot, different y-axes using matplotlib (no pandas)
The implementation can be done as follows:
Graph