matplotlib作图--同x轴双y轴
来源:互联网 发布:osek网络管理有什么用 编辑:程序博客网 时间:2024/05/16 09:35
#!/usr/bin/env python2.7# -*- coding: utf8 -*-"""Purpose: File: /home/cz/Program/eclipse/GP/efficiency_factor.pyAuthor: CHANG ZhiDate: 2014-12-24E-mail: """import osimport numpy as npimport matplotlib.pyplot as pltdatafile = 'data/abc.dat'if(os.path.isfile(datafile)): cat = np.genfromtxt(datafile,delimiter="") bars,factor,evts= cat[:,0],cat[:,1],cat[:,2]else: print datafile,' do not exist.\n' exit(0)#host = plt.subplots()fig,left_axis=plt.subplots()#fig.subplots_adjust(right_axis=0,75)right_axis = left_axis.twinx()p1, = left_axis.plot(bars, abs(factor), 'b.-')p2, = right_axis.plot(bars, evts/(5000000*(3*np.sqrt(3)/(2*np.pi))), 'r.-')left_axis.set_xlim(40,410)#left_axis.set_xticks(np.arange(0,110,10))left_axis.set_ylim(0.265,0.355)left_axis.set_yticks(np.arange(0.27,0.36,0.01))#right_axis.set_ylim(0,0.26)#right_axis.set_yticks(np.arange(0,0.26,0.02))left_axis.set_xlabel('Bar Number in One Edge')left_axis.set_ylabel('Modulation Factor')right_axis.set_ylabel('Efficiency')left_axis.yaxis.label.set_color(p1.get_color())right_axis.yaxis.label.set_color(p2.get_color())tkw = dict(size=5, width=1.5)left_axis.tick_params(axis='y', colors=p1.get_color(), **tkw)right_axis.tick_params(axis='y', colors=p2.get_color(), **tkw)left_axis.tick_params(axis='x', **tkw)plt.savefig('fig/abc.eps')plt.show()
0 0
- matplotlib作图--同x轴双y轴
- Matplotlib,控制x,y轴坐标标记步长
- matplotlib作图
- Matplotlib 双Y轴曲线
- 用matplotlib作图步骤
- 应用Matplotlib来作图
- python-matplotlib-作图分析
- matplotlib 作图基本配置
- python matplotlib作图
- matplotlib作图布局
- matplotlib作图添加表格
- python 之 matplotlib 作图
- python matplotlib 绘制双Y轴曲线图
- python的matplotlib实现双Y轴
- python matplotlib 绘制双Y轴曲线图
- x/y/z轴
- 使用python科学作图包matplotlib作图
- Matplotlib 作图中文无法显示
- POJ-2956(优化枚举||BFS)
- VC下实现虚拟桌面的两种方案
- Ubuntu 12.04 LTS 中文输入法的安装
- 寄生虫程序的设计思路
- Unity 访问2d组件 Sprite Renderer
- matplotlib作图--同x轴双y轴
- JAVA 文件操作之字符流(FileOutPutStream/FileIntPutStream)和字节流(FileWriter/FileReader)
- php多条件筛选
- Microsoft VBScript 运行时错误 错误 '800a01a8' 缺少对象: ''
- orcl 事务与事务控制
- 求学在卡梅
- tableView默认样式cell.imageView位置的设定
- 使用cloudera impala sql 进行交集、并集、差集查询
- 类型转换