Py中pyplot之subplot例子【转载】
转自:https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html
1.有NaN的余弦图subplot
import numpy as np
import matplotlib.pyplot as plt t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(2 * 2*np.pi * t)
t[41:60] = np.nan plt.subplot(2, 1, 1)#两行一列的子图,目前在第一个位置画。
plt.plot(t, s, '-', lw=2) plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('A sine wave with a gap of NaNs between 0.4 and 0.6')
plt.grid(True) plt.subplot(2, 1, 2)#在第二位时
t[0] = np.nan
t[-1] = np.nan#最后一个也是NaN
plt.plot(t, s, '-', lw=2)
plt.title('Also with NaN in first and last point') plt.xlabel('time (s)')
plt.ylabel('more nans')
plt.grid(True) #plt.tight_layout()没有这一句的话,第二张图的标题和第一张图的xlabel会重合。
plt.show()

去掉布局的注释:

2.图例legend
ax.legend(…., loc=3) 具体对应位置如下图

3.subplots函数返回
Returns
-------
fig : :class:`matplotlib.figure.Figure` object ax : Axes object or array of Axes objects. ax can be either a single :class:`matplotlib.axes.Axes` object or an
array of Axes objects if more than one subplot was created. The
dimensions of the resulting array can be controlled with the squeeze
keyword, see above.
4.subplot函数
def subplot(*args, **kwargs):
"""
Return a subplot axes positioned by the given grid definition. Typical call signature:: subplot(nrows, ncols, plot_number)
Py中pyplot之subplot例子【转载】的更多相关文章
- Py中re.sub学习【转载】
转自:https://www.crifan.com/python_re_sub_detailed_introduction/ //这个网址讲的不错. 1.re.sub的功能 re是regular ex ...
- Py中的矩阵乘法【转载】
转自:https://blog.csdn.net/cqk0100/article/details/76221749 1.总结 对于array对象,*和np.multiply函数代表的是数量积,如果希望 ...
- [django]urls.py 中重定向
Django 1.5 有时候需要对一个链接直接重定向,比如首页啥的重定向到一个内容页等等,在views.py 中可以设定,如果没有参数啥的在urls.py 中设定更加方面 from django.vi ...
- easyui datagrid 禁止选中行 EF的增删改查(转载) C# 获取用户IP地址(转载) MVC EF 执行SQL语句(转载) 在EF中执行SQL语句(转载) EF中使用SQL语句或存储过程 .net MVC使用Session验证用户登录 PowerDesigner 参照完整性约束(转载)
easyui datagrid 禁止选中行 没有找到可以直接禁止的属性,但是找到两个间接禁止的方式. 方式一: //onClickRow: function (rowIndex, rowData) ...
- OpenFOAM 中边界条件的设定【转载】
转载自:http://blog.sina.com.cn/s/blog_a0b4201d0102v7jt.html 用习惯了FLUENT的操作界面,再使用OpenFOAM就会觉得非常繁琐.遇到的第一个问 ...
- Python中super的用法【转载】
Python中super的用法[转载] 转载dxk_093812 最后发布于2019-02-17 20:12:18 阅读数 1143 收藏 展开 转载自 Python面向对象中super用法与MRO ...
- py中变量名的“秘密”
今天突然脑子发抽,想到py里有没有指针这个概念,于是我马上google.baidu了一波,发现网上大多都在说py.java.c#这类纯面向对象的编程语言用对象的概念能完全替代指针.那么问题来了,没有指 ...
- python调用py中rar的路径问题。
1.python调用py,在py中的os.getcwd()获取的不是py的路径,可以通过os.path.split(os.path.realpath(__file__))[0]来获取py的路径. 2. ...
- Django 中 如何使用 settings.py 中的常量
在用django 框架开发 python web 程序的时候 , 在模板页面经常会用到 settings.py 中设置的常量,比如MEDIA_URL, 我尝试过在模板页面用类似如下的方式 程序代码 { ...
随机推荐
- jsp连接数据库的乱码问题 servlet请求参数编码处理get post
1.在所有需要读取数据的地方用下面的方式.同时jsp必须统一编码,如我都是UTF-8 String userName= new String(request.getParameter("us ...
- C# EF中调用 存储过程并调回参数
TourEntities db = new TourEntities(); List<v_product> v = new List<v_product>(); SqlPara ...
- Why is IMAP better than POP?
https://www.fastmail.com/help/technical/imapvspop.html POP is a very simple protocol that only allow ...
- 异构GoldenGate 12c 单向复制配置
1.分别在windows2008.linux平台部署oracle 11.2.0.4 2.分别在windows2008.linux平台部署gg. 2.1 windows平台: gg的安装目录位 C:\o ...
- [原]git的使用(六)---远程仓库
10.远程仓库 -------------------------------------------------------------------------------------------- ...
- Apache 的mod_auth_cas模块的介绍和使用
apache的mod_auth_cas模块是一个集成到apache中的cas客户端,一般是配合Apache的反向代理来使用,对某个url的请求先经过apache,apache会判断是否经过cas认证, ...
- 在UI自动化测试中使用flaky插件运行失败用例
在UI自动化测试中,有时候经常会提示跑用例失败,在单步或单个用例调试时,用例却成功,这个失败的因素主要有环境.代码或前端定位等原因. 可以看这篇文章<我们是如何让UI测试变得稳定的>中有详 ...
- 关于Jmeter3.0,你必须要知道的5点变化
2016.5.18日,Apache 发布了jmeter 3.0版本,本人第一时间上去查看并下载使用了,然后群里或同事都会问有什么样变化呢?正好在网上看到一遍关于3.0的文章,但是是英文的.这里翻译一下 ...
- python--pytest库
pytest:是一个框架,使构建简单和可扩展的测试变得容易. 安装:pip install -U pytest 检查安装:pytest --version 官方文档:https://docs.pyte ...
- confirm
注意confirm是window对象的方法,当确认时,返回true,取消时,返回false