简体   繁体   English

如何在python中绘制两个选定列的分组条形图与时间的关系图。 我将在下面发布我的数据

[英]How to plot grouped bar chart from two selected columns vs time in python. I shall post my data below

Below is my data 以下是我的数据

             voc_x        isc_x       ff_x         voc_y     isc_y  ff_y
time                        
2017-09-30  63.782472   9.550849    1.488919    61.874962   9.602439    1.429964
2017-10-31  55.189029   7.983348    1.309940    52.859371   7.939833    1.240761
2017-11-30  74.396234   9.259505    1.741323    74.866330   10.232798   1.704126
2017-12-31  83.635085   10.894306   1.882668    83.940575   11.576104   1.860751
2018-01-31  82.980214   10.831514   1.870142    83.073124   11.182076   1.847038
2018-02-28  85.214404   10.695147   2.014127    85.785134   11.898783   1.950388
2018-03-31  79.562794   12.326437   1.789034    80.054074   12.916880   1.763306
2018-04-30  89.114989   11.223809   2.038167    89.770275   11.619562   2.015162
2018-05-31  105.814776  13.075636   2.454240    106.846945  14.197378   2.412194
2018-06-30  106.823234  13.518760   2.482140    107.725764  14.380820   2.457114
2018-07-31  103.054588  12.616497   2.416309    104.097460  13.220893   2.396395
2018-08-31  97.295219   11.295392   2.385163    98.166561   12.535381   2.316326

I need to plot a graph of isc_X and isc_y as grouped bar plot vs time (x axis) in python. 我需要绘制isc_Xisc_y的图形作为isc_y中的分组条形图与time (x轴)。

It's a bit hard to understand what you want. 理解你想要的东西有点难。 Can you add more detail or include an image of what it might look like. 您可以添加更多细节或包含它可能是什么样的图像。

Is this what you want: 这是你想要的吗:

df.pivot("Time", "isc_x", "isc_y").plot(kind='bar')

Probably you want something like this: 可能你想要这样的东西:

df = df[['isc_x', 'isc_y']]
df.plot.bar()
import matplotlib.pyplot as plt
plt.show()

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

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