1.说明

1.1 多图:

221,222

212

------------附最后讲解,这下更清楚了吧,取个名字:颠倒一下---

1.2 多图

211

223,224

------------附最后讲解,这下更清楚了吧-----

2.图

3.代码

import numpy as np
import matplotlib.pyplot as plt def f(t):
return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 3.0, 0.01) #表1
#ax1 = plt.subplot(221)
ax1 = plt.subplot(2,2,1) #221=2,2,1
ax1.margins(2, 2) # Values >0.0 zoom out
ax1.plot(t1, f(t1), 'r')
ax1.set_title('pic-1')
#表2
ax2 = plt.subplot(222) #222=2,2,2
ax2.margins(x=0, y=-0.25) # Values in (-0.5, 0.0) zooms in to center
ax2.plot(t1, f(t1), 'g')
ax2.set_title('pic-2') #表3
#ax3 = plt.subplot(212) #212=2,1,2=223+224=第2行,第1列,占2个位置?
ax3 = plt.subplot(2,1,2)
ax3.margins(0.05) # Default margin is 0.05, value 0 means fit
ax3.plot(t1, f(t1), 'k')
ax3.set_title('pic-3') plt.show()#展现图片

4.说明

subplot的参数221意思就是,把整个大的画板分成2*2,这个子图在第1个位置,占一个位置
因为分成了2*2,那么还可以有222,223,224.
如下布局
---------
221 222
223 224
---------
plt.subplot(2,2,1)表示将整个图像窗口分为2行2列, 当前位置为1.
教学地址
https://morvanzhou.github.io/tutorials/data-manipulation/plt/4-1-subpot1/
未说明:212=223+224=第2行,第1列,占2个位置
 
5.颠倒一下,更清楚
5.1 多图显示
--------------------------
211(221,222)
223 , 224(212)
------------------------
看懂了么?我搞懂了。
5.2 代码:修改一下
import numpy as np
import matplotlib.pyplot as plt def f(t):
return np.exp(-t) * np.cos(2*np.pi*t)
t1 = np.arange(0.0, 3.0, 0.01) #表1
ax1 = plt.subplot(223)
ax1.margins(2, 2)
ax1.plot(t1, f(t1), 'r')
ax1.set_title('pic-1')
#表2
ax2 = plt.subplot(224)
ax2.margins(x=0, y=-0.25)
ax2.plot(t1, f(t1), 'g')
ax2.set_title('pic-2') #表3
ax3 = plt.subplot(211)
ax3.margins(0.05)
ax3.plot(t1, f(t1), 'k')
ax3.set_title('pic-3') plt.show()#展现图片

5.3 图

 
 
 
 
 
 
 
 
 
 
 
 
 

python下matplotlib的subplot的多图显示位置的问题的更多相关文章

  1. python下matplotlib、numpy、pandas联合作图逐步深入分析

    1.代码1: from pandas import Series,DataFrame from numpy.random import randn import numpy as np import ...

  2. python的matplotlib的热门可视化动图

    1.图 2.代码 import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import matplot ...

  3. Python中matplotlib.pyplot.imshow画灰度图的多种方法

    转载:https://www.jianshu.com/p/8f96318a153f matplotlib库的教程和使用方法此处就不累赘了,网上有十分多优秀的教程资源.此处直接上代码: def demo ...

  4. python中matplotlib绘图封装类之折线图、条状图、圆饼图

    DrawHelper.py封装类源码: import matplotlib import matplotlib.pyplot as plt import numpy as np class DrawH ...

  5. 利用matlab编写实现显示fmri切片slice图像 混合显示 不同侧面显示 可叠加t检验图显示 by DR. Rajeev Raizada

    1.参考 reference 1. tutorial主页:http://www.bcs.rochester.edu/people/raizada/fmri-matlab.htm. 2.speech_b ...

  6. python使用matplotlib绘制折线图教程

    Matplotlib是一个Python工具箱,用于科学计算的数据可视化.借助它,Python可以绘制如Matlab和Octave多种多样的数据图形.下面这篇文章主要介绍了python使用matplot ...

  7. python 下 tinker、matplotlib 混合编程示例一个

    该例是实现了 Tinker 嵌入 matplotlib 所绘制的蜡烛图(k 线),数据是从 csv 读入的.花一下午做的,还很粗糙,仅供参考.python 代码如下: import matplotli ...

  8. Python画图matplotlib展示图中中文乱码

    在用python的 matplotlib 画图的时候,在图表上面有中文乱码问题,如下的: 解决过程: 平台:windows,python2.7步骤一:打开设置文件 import matplotlib ...

  9. python之matplotlib绘图基础

    Python之matplotlib基础 matplotlib是Python优秀的数据可视化第三方库 matplotlib库的效果可参考 http://matplotlib.org/gallery.ht ...

随机推荐

  1. 马俊龙ansible教程分享

    ansible详细介绍和教程链接:https://www.cnblogs.com/f-ck-need-u/p/7576137.html#ansible

  2. Custom LED Keychain, Small And Surefire Gifts

    The    LED Keychain    makes it easy for people to carry their keys with them and carry them with th ...

  3. 每天进步一点点------Allegro 动态显示走线长度

    手工布线时还可以动态显示当前走线的长度,设置方法为执行菜单命令Setup->User preferences,打开User preferences Editor对话框.在Etch对应的环境变量中 ...

  4. docker互联机制实现便捷互访

    何为容器互联 & 为何需要容器互联 容器的互联是一种让多个容器中应用进行快速交互的方式,它会在源和接收容器之间创建连接关系,接收容器可以通过容器名快速访问到源容器,而不用指定具体的 ip 地址 ...

  5. Swagger-ui接口文档

    参考地址 https://github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X#quick-annotation-overview   ...

  6. Python - 标准库部分函数、类的大致实现(持续更新)

    all() def all(iterable): for element in iterbale: if not element: return False return True any() def ...

  7. FreeRTOS学习笔记5:队列

    为通信而准备 1.任务存储存储缓冲机制:先进先出 FIFO 后进先出 LIFO (ucOS消息队列采用的是引用传递,传递的都是指针.采用引用的话,内容必须一致保持可见性,即消息内容必须有效.1.不能传 ...

  8. go使用错误概览

    1. 解决:GO语言中要提供给外面访问的方法或是结构体必须是首字母大写.这个结构体只有结构体名大写了,而里面的字段没有首字母大写,而GO语言在模板调用时应该认为是两个不同的过程,所以找不到值.于是把结 ...

  9. Python(二):做题函数记录

    一,10进制 转 2,8,16进制 bin(<int>) ,oct(<int>),hex(<int>) 输出示例 '0b10011010010' '0o2322' ...

  10. Flutter 中的常见的按钮组件 以及自 定义按钮组件

    一.Flutter 中的按钮组件介绍   Flutter 里有很多的 Button 组件很多,常见的按钮组件有:RaisedButton.FlatButton.   IconButton.Outlin ...