《Deep Learning Series》
  • 深耕系列之深度学习笔记
  • 第一章 Linux学习环境相关配置
    • 1.1 Ubuntu18下有道词典的配置
    • 1.2 Ubuntu18 安装Gitbook
    • 1.3 Ubuntu18 git命令使用总结
    • 1.4 Latex 排版使用笔记
    • 1.5 Ubuntu下常用工具软件配置安装
    • 1.6 win10+ubuntu双系统修复ubuntu启动引导
    • 1.7 gitbook 插件等相关设置
    • 1.8 深度学习环境搭建
    • 1.9 hexo 实现本地图片加载
    • 1.10 hexo网页定制
    • 1.11 sublime text3插件介绍
    • 1.12 vsftpd.conf文件配置
    • 1.13 mysql 笔记
    • 1.14 ubuntu16_18安装peek工具录制gif
    • 1.15 ubuntu下goldendict有道爬虫小程序
    • 1.16 ubuntu18升级后部分应用不能中文输入的问题
    • 1.17 ubuntu下安装有道词典
    • 1.18 opencv 安装
    • 1.19 gym_gazabe安装配置
    • 1.20 docker 基础
    • 1.21 docker_配置权限问题
    • 1.22 jupyternotebook使用
  • 第二章 深度学习相关基础算法
    • 2.1 马尔科夫链
      • 2.1.1 马尔科夫简单模型预测实战笔记
      • 2.1.2 最大熵模型
      • 2.1.3 隐马尔科夫HMM
    • 2.2 矩阵相关基础知识
    • 2.3 线性回归
    • 2.4 决策树
    • 2.5 梯度下降和最小二乘法
    • 2.6 递归算法与迭代算法
    • 2.7 神经网络浅学笔记
    • 2.8 强化学习经验回放
    • 2.9 K近邻算法
    • 2.10 朴素贝叶斯法
    • 2.11 极大似然估计
    • 2.12 logistic regression
  • 第三章 深度学习框架学习
    • 3.1 PyTorch 学习
      • 3.1.2 Pytorch 之MNIST手写字识别分类
    • 3.2 tensorflow学习笔记
      • 3.2.1 tensorflow之MNIST
    • 3.3 matplotlib函数
    • 3.4 numpy函数
  • 第四章 ROS机器人
    • ROS室内仿真环境.md
    • ros and gazebo and gym_gazebo安装
    • ubuntu16 安装gym-gazebo
    • gym-gazebo安装后的测试
    • 基于DQN的gym_gazebo运行代码演示
  • 项目开发
    • Library占座小工具使用手册
  • 附录
    • Python 相关笔记
      • Python 帮助文档检索方法
      • Module篇使用future
    • Git 相关配置
      • git-推送新的文章到github其他分支上
      • gitignre 配置
      • gitignre 配置
      • Hexo 每次写好后deploy博客
      • MFC Socket 通信
      • python之tkinter入坑Pack
      • ubuntu 中安装sublime_text3
      • ubuntu18-正确-安装ShadowSocket
      • vultr+freenom实现主机域名的绑定.md
      • 值得收藏的网站
      • 搜索技巧
      • 第一篇博文
      • 简单的方法,越过付费获取在线的log设计.md
      • 网页设计基础笔记.md
      • 解决Chrome67版本以后不能离线安装插件的情况.md
    • 嵌入式相关笔记
      • STM32串口通信配置
      • STM32复位及通过函数判断是何种条件出发的复位
Powered by GitBook
On this page
  • interactive模式特点:
  • plt.ion()
  • plt.ioff()
  • 常用函数
  • plt.figure()
  • plt.plot()

Was this helpful?

  1. 第三章 深度学习框架学习

3.3 matplotlib函数

Previous3.2.1 tensorflow之MNISTNext3.4 numpy函数

Last updated 5 years ago

Was this helpful?

本节主要是学习matplotlib的函数调用,主要是基础的学习路线,包括简单的实例笔记等。

interactive模式特点:

plt.ion()

plt.ioff()

开启interactive模式,用plt.ion(),放在绘图之前,关闭该模式用plt.ioff();

python可视化库matplotlib有两种显示模式:

  • 阻塞(block)模式

  • 交互(interactive)模式

在Python Consol命令行中,默认是交互模式。而在python脚本中,matplotlib默认是阻塞模式。

在交互模式下, plt.plot(x)或plt.imshow(x)是直接出图像,不需要plt.show() 如果在脚本中使用ion()命令开启了交互模式,没有使用ioff()关闭的话,则图像会一闪而过,并不会常留。要想防止这种情况,需要在plt.show()之前加上ioff()命令。

在阻塞模式下, 打开一个窗口以后必须关掉才能打开下一个新的窗口。这种情况下,默认是不能像Matlab一样同时开很多窗口进行对比的。 plt.plot(x)或plt.imshow(x)是直接出图像,需要plt.show()后才能显示图像

下面这个例子讲的是如何像matlab一样同时打开多个窗口显示图片或线条进行比较,同时也是在脚本中开启交互模式后图像一闪而过的解决办法:

    import matplotlib.pyplot as plt
    plt.ion()    # 打开交互模式
    # 同时打开两个窗口显示图片
    plt.figure()
    plt.imshow(i1)
    plt.figure()
    plt.imshow(i2)
    # 显示前关掉交互模式
    plt.ioff()
    plt.show()

常用函数

plt.figure()

Parameters:

  • num : integer or string, optional, default: None

If not provided, a new figure will be created, and the figure number will be incremented. The figure objects holds this number in a number attribute. If num is provided, and a figure with this id already exists, make it active, and returns a reference to it. If this figure does not exists, create it and returns it. If num is a string, the window title will be set to this figure's num.

  • figsize : (float, float), optional, default: None

width, height in inches. If not provided, defaults to rcParams["figure.figsize"] = [6.4, 4.8].

  • dpi : integer, optional, default: None

resolution of the figure. If not provided, defaults to rcParams["figure.dpi"] = 100.

  • facecolor :

the background color. If not provided, defaults to rcParams["figure.facecolor"] = 'w'.

  • edgecolor :

the border color. If not provided, defaults to rcParams["figure.edgecolor"] = 'w'.

  • frameon : bool, optional, default: True

If False, suppress drawing the figure frame.

  • FigureClass : subclass of Figure

Optionally use a custom Figure instance.

  • clear : bool, optional, default: False

If True and the figure already exists, then it is cleared.

Returns:

  • figure : Figure

The Figure instance returned will also be passed to new_figure_manager in the backends, which allows to hook custom Figure classes into the pyplot interface. Additional kwargs will be passed to the Figure init function.

plt.plot()

摘要
interactive模式特点:
plt.ion()
plt.ioff()
常用函数
plt.figure()
Parameters:
Returns:
plt.plot()