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. centos Install Docker

    安装必备软件 $ yum -y install iptables iptables-services net-tools vim wget $ wget -P ~ https://github.com ...

  2. android progressdialog 对话框试用实例

    ProgressDialog 跟AlertDialog用法差不多,不同的是:ProgressDialog 显示的是一种"加载中"的效果,android 中 ProgressDial ...

  3. .net跨防火墙链接oracle连接池链接长时间无通讯数据被断开后报错问题解决

    环境: .net 4.0以上使用Oracle.ManagedDataAccess组件链接oracle数据库,应用程序与数据库之间存在硬件防火墙. 症状:应用程序启动后正常访问,如果出现长时间无数据库请 ...

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

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

  5. 【清北学堂2018-刷题冲刺】Contest 9

     前几天本蒟蒻一直在颓废所以这篇题解咕了很久,而且最后一个题目不太会,最终也没完成,非常惭愧.  写这些题目收获相当大.后面的日子呢,我会继续着手刷NOIP题目和Codeforces题目.  到这里就 ...

  6. SQL Server 2008以上误操作数据库恢复方法——日志尾部备份

    原文出处:http://blog.csdn.net/dba_huangzj/article/details/8491327 问题: 经常看到有人误删数据,或者误操作,特别是update和delete的 ...

  7. frp源码剖析-frp中的mux模块

    前言 frp几乎所有的连接处理都是构建在mux模块之上的,重要性不必多说,来看一下这是个啥吧 ps: 安装方法 go get "github.com/fatedier/golib/net/m ...

  8. Harbor镜像迁移

    目录 背景说明 方案实现 背景说明 在早期生产环境尝试使用docker的时候,虽然使用了harbor作为镜像仓库,但是并没有做好相关存储规划,所有的镜像都直接存储到了harbor本地.随着业务发展,本 ...

  9. 2018acm-icpc宁夏邀请赛后记

    由于要准备期末考试的缘故,时隔一个月之后我才想起来还有一场比赛没有总结. 大概是出去过的最远的地方了,宁夏理工学院离杭州有两千多千米. 不得不说感到了主办方满满的诚意,虽然是第一次办比赛,但是第一天组 ...

  10. 20181114 Redis

    Redis 下载 Windows版本 Windows版本 已经有很久没有更新了,建议还是使用Linux版本 Linux版本 官网下载即可 配置文件 Windows版本 redis.windows.co ...