博客
关于我
画多个图及相关细节总结
阅读量:298 次
发布时间:2019-03-03

本文共 1836 字,大约阅读时间需要 6 分钟。

            fig, (ax1, ax2,ax3) = plt.subplots(3,1, figsize=(15,10),facecolor='white')

            plt.subplots_adjust(hspace=0.5)
            mpf.candlestick_ochl(ax1, k_test_data_values, width=1.0, colorup = 'r', colordown = 'g')
            ax1.set_title(test_code)
            ax1.set_ylabel('Price')
            ax1.grid(True)
            x_list=n_division(len(k_test_data),5)
            ax1.set_xticks(x_list)
            ax1.set_xticklabels(k_test_data.ix[x_list,'str_date'])
            mpf.candlestick_ochl(ax2, find_data_values, width=1.0, colorup = 'r', colordown = 'g')
            ax2.set_title(find_code)
            ax2.set_ylabel('Price')
            ax2.grid(True)
            x2_list=n_division(len(find_data),5)
            ax2.set_xticks(x2_list)
            ax2.set_xticklabels(find_data.ix[x2_list,'str_date'])
            """收盘价数据"""
            two_closes=pd.DataFrame()
            two_closes['test']=k_test_data['dealed_close'].values
            two_closes['find']=find_data['dealed_close'].values
            two_closes.reset_index(drop=True,inplace=True)
            two_closes.plot(ax=ax3)
            ax3.text(cnt//2,0.5,'similarity:'+str(result.ix[find_idx,'ratio']),family='monospace',fontsize=10)
            plt.show()

fig,ax1=plt.subplots(1,figsize=(10,8))

plot_data[[bench_column_name]].plot(c='r',ax=ax1)
plot_data[ref1_columns_name].plot(c='b',ax=ax1)
plot_data[ref2_columns_name[0:3]].plot(c='g',ax=ax1)
plot_data[ref2_columns_name[3:6]].plot(c='y',ax=ax1)
ax1.set_title(bench_mark+'_'+begin_date+'_'+over_date+" similar k lines")
#ax1.set_xticklabels(x_labels)
ax1.set_xlabel('date')
ax1.set_ylabel('net')
fig.savefig('pdf/'+'_new_algo_'+prefix+'_'+bench_mark+'_'+begin_date+'_'+over_date+'.pdf',dpi=1000,bbox_inches='tight')
plt.show()

        import matplotlib.mlab as mlab

        import matplotlib.pyplot as plt
        labels=[u'big_big_down',u'big_down',u'down',u'up',u'big_up',u'big_big_up']
        X=test_result[-1].reshape(-1,).tolist()
        fig = plt.figure()
        plt.pie(X,labels=labels,autopct='%1.2f%%') #画饼图(数据,数据对应的标签,百分数保留两位小数点)
        plt.title(code+'_lstm_prob')
        plt.savefig(code+'_lstm_prob'+'.pdf')
        plt.show()

你可能感兴趣的文章
2021年G1工业锅炉司炉考试报名及G1工业锅炉司炉模拟考试题库
查看>>
大数据学习之Spark——00Spark项目的pom.xml文件
查看>>
大数据学习之Spark——01Spark概述
查看>>
比特币史话·78 | 有容乃大(2): 零食售卖机
查看>>
比特币史话·96 | 隐私(3): 熔币重铸
查看>>
Fire prejudice: 巴菲特搭档芒格首度认可比特币
查看>>
从 MFC 移植程序到 wxWidgets 界面库 ——《定时执行专家 5.0》的界面实现
查看>>
GLUT和wxWidgets在OpenGL开发中的比较
查看>>
CodeBlocks开发wxWidgets环境配置详细
查看>>
Qt 转向 LGPL之后,wxWidgets 路在何方
查看>>
[翻译]2009年6月wxWidgets更新 - 支持图标的wxButton
查看>>
wxSqlite3 和 wxPropertyGrid 类库的说明
查看>>
天涯人脉通讯录 - 设计草图
查看>>
超级网际搜索(SuperSearch) - 4月2日最新版V5.2.41.53,内置搜索引擎更新到147个
查看>>
wxWidgets 最新版2.8.11,终于放出来了
查看>>
报表模板更新 - 代码统计工具 - 最新版3.4.1.1 放出
查看>>
linux使用yum安装软件报错
查看>>
python学习09:暂停一秒后再输出
查看>>
4、Mysql 主从复制报错[ERROR] [MY-013117] 踩坑
查看>>
6、ShardingSphere 之 读写分离
查看>>