graph.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:rapidpythonprogramming 作者: thecount12 项目源码 文件源码
def graphData(stock):
        stockFile=stock+".txt"

        date,closep,highp,lowp,openp,volume= np.loadtxt(stockFile,delimiter=',',unpack=True,
                        converters={0: mdates.strpdate2num('%Y%m%d')})
        fig=plt.figure()
        ax1=plt.subplot(1,1,1) # how much by how much by 
        ax1.plot(date,openp)
        ax1.plot(date,highp)
        ax1.plot(date,lowp)
        ax1.plot(date,closep)

        #pretty it up
        ax1.xaxis.set_major_locator(mticker.MaxNLocator(10)) #max10days
        ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))

        # rotate
        for label in ax1.xaxis.get_ticklabels():
            label.set_rotation(45)


        plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号