首页 > 怎样用Python画概率图?横坐标为time or frequency.纵坐标为概率P。

怎样用Python画概率图?横坐标为time or frequency.纵坐标为概率P。

已经得到了一组二维数据,如何用Python画出它的概率分布图?使之横坐标为time,纵坐标为概率P。或者横坐标为frequency,纵坐标为概率P。


之前使用的是matplotlib,我的数据都是存到sqlite里的
横坐标是时间,纵坐标是耗时
大概如下:

import matplotlib.pyplot as plt
.....
for tbl in tbl_list:
    y_b=[]
    x_a=[]
    for a,b in cur.execute("select CREATE_TIME,T_COST from %s where create_time between '2014/11/13 12:00:00.000' and '2014/11/14 08:59:59.999' order by create_time asc " % tbl):
        y_b.append(b)
        x_a.append(datetime.strptime(a.lstrip(),'%Y/%m/%d %H:%M:%S.%f'))

    plt.figure(tbl,figsize=(13,7))
    plt.title(tbl)
    plt.plot(x_a, y_b, linewidth=0.25, color='red')
    #plt.show()
    plt.savefig(tbl+".png")
【热门文章】
【热门文章】