Difference between plt.draw() and plt.show() in matplotlib

down voteaccepted

plt.show() will display the current figure that you are working on.

plt.draw() will re-draw the figure. This allows you to work in interactive mode and, should you have changed your data or formatting, allow the graph itself to change.

The plt.draw docs state:

This is used in interactive mode to update a figure that has been altered using one or more plot object method calls; it is not needed if figure modification is done entirely with pyplot functions, if a sequence of modifications ends with a pyplot function, or if matplotlib is in non-interactive mode and the sequence of modifications ends with show() or savefig().

This seems to suggest that using plt.draw() before plt.show() when not in interactive mode will be redundant the vast majority of the time. The only time you may need it is if you are doing some very strange modifications that don't involve using pyplot functions.

Refer to the Matplotlib FAQ, "What is interactive mode?" for more information.

Difference between plt.draw() and plt.show() in matplotlib的更多相关文章

  1. plt.contour 与 plt.contourf

    contour:轮廓,等高线 1.为等高线上注明等高线的含义: cs = plt.contour(x, y, z) plt.clabel(cs, inline=True, fontsize=10)#i ...

  2. matplotlib 画动态图以及plt.ion()和plt.ioff()的使用

    学习python的道路是漫长的,今天又遇到一个问题,所以想写下来自己的理解方便以后查看. 在使用matplotlib的过程中,常常会需要画很多图,但是好像并不能同时展示许多图.这是因为python可视 ...

  3. elf文件中的.plt .rel.dyn .rel.plt .got .got.plt的关系

    .plt的作用是一个跳板,保存了某个符号在重定位表中的偏移量(用来第一次查找某个符号)和对应的.got.plt的对应的地址 .rel.dyn重定向表,在程序启动时就需要重定位完成. .rel.plt保 ...

  4. matplotlib中的plt.ion()和plt.ioff()函数

    转自https://blog.csdn.net/yzy__zju/article/details/85008603 Matplotlib的显示模式默认为阻塞(block)模式,因此若想动态显示图像,则 ...

  5. 4.6Python数据处理篇之Matplotlib系列(六)---plt.hist()与plt.hist2d()直方图

    目录 目录 前言 (一)直方图 (二)双直方图 目录 前言 今天我们学习的是直方图,导入的函数是: plt.hist(x=x, bins=10) 与plt.hist2D(x=x, y=y) (一)直方 ...

  6. 4.4Python数据处理篇之Matplotlib系列(四)---plt.bar()与plt.barh条形图

    目录 目录 前言 (一)竖值条形图 (二)水平条形图 1.使用bar()绘制: 2.使用barh()绘制: (三)复杂的条形图 1.并列条形图: 2.叠加条形图: 3.添加图例于数据标签的条形图: 目 ...

  7. Matplotlib系列(四)--plt.bar与plt.barh条形图

    (一)竖条条形图 参数说明 参数 说明 类型 x x坐标 int,float height 条形的高度 int,float width 线条的宽度 0~1,默认是0.8 botton 条形的起始位置 ...

  8. Python中plt.plot()、plt.scatter()和plt.legend函数的用法示例

    参考:http://www.cppcns.com/jiaoben/python/471948.html https://blog.csdn.net/weixin_44825185/article/de ...

  9. Linux终端没有GUI,使用matplotlib绘图

    一.解决警告信息 ... _tkinter.TclError: no display name and no $DISPLAY environment variable 两种解决方法: 1.pytho ...

随机推荐

  1. BZOJ 4785 [Zjoi2017]树状数组 | 二维线段树

    题目链接 BZOJ 4785 题解 这道题真是令人头秃 = = 可以看出题面中的九条可怜把求前缀和写成了求后缀和,然后他求的区间和却仍然是sum[r] ^ sum[l - 1],实际上求的是闭区间[l ...

  2. can总线的示波器检测方法

    stm32的can总线是在APB1上的,stm32f10x的主频是72Mhz,can外设时钟是36Mhz,stm32f2xx的主频是120Mhz,can外设时钟是30Mhz... STM32 APB1 ...

  3. synchronized的实现原理与应用

    Java代码在编译后会变成Java字节码,字节码被类加载器加载到JVM里,JVM执行字节码,最终需要转化为汇编指令在CPU上执行,Java中所使用的并发机制依赖于JVM的实现和CPU的指令. sync ...

  4. Gym 100971J-Robots at Warehouse

    题目链接:http://codeforces.com/gym/100971/problem/J Vitaly works at the warehouse. The warehouse can be ...

  5. detectMultiScale 读取冲突的一个解决方法

    背景:用的是opencv的HOGDescriptor检测行人,实例化为hog:使用默认的行人检测器: hog.setSVMDetector(cv::HOGDescriptor::getDefaultP ...

  6. SDL源码阅读笔记(2) video dirver的初始化及选择

    write by 九天雁翎(JTianLing) -- blog.csdn.net/vagrxie 前一篇文章 讲了SDL的除video以外的大部分模块.本文主要关注SDL的video模块部分. SD ...

  7. JAVA8给我带了什么——流的概念和收集器

    到现在为止,笔者不敢给流下定义,从概念来讲他应该也是一种数据元素才是.可是在我们前面的代码例子中我们可以看到他更多的好像在表示他是一组处理数据的行为组合.这让笔者很难去理解他的定义.所以笔者不表态.各 ...

  8. 文件拷贝, 使用 BIO,NIO的对比,四种写法性能分析。

    测试环境: jdk 1.7 +  2G内存 测试代码基本上复制了: http://blog.csdn.net/tabactivity/article/details/9317143 1 2 3 4 5 ...

  9. GBDT原理详解

    从提升树出发,——>回归提升树.二元分类.多元分类三个GBDT常见算法. 提升树 梯度提升树 回归提升树 二元分类 多元分类 面经 提升树 在说GBDT之前,先说说提升树(boosting tr ...

  10. AS3.0:给图片添加滤镜模糊与斜角效果

    滤镜可应用于任何显示对象(即,从 DisplayObject 类继承的对象), 例如 MovieClip.SimpleButton.TextField 和 Video 对象,以及 BitmapData ...