python matplotlib绘图
2015-07-08 12:49
771 查看
matplotlib: clearing a plot, when to use cla(), clf() or close()?
Matplotlib offers three functions:cla() # Clear axis clf() # Clear figure close() # Close a figure windowThe documentation doesn't offer a lot of insight into what the difference between these functions is. When should I use each function and what exactly does it do?
They all do different things, since matplotlib uses a hierarchical order in which a figure window contains a figure which may consist of many axes. The three commands you mention therefore do the following:cla() clears an axis, i.e. the currently active axis in the current figure. It leaves the other axes untouched.clf() clears the entire current figure with all its axes, but leaves the window opened, such that it may be reused for other plots.close() closes a window, which will be the current window, if not specified otherwise.Which functions suits you best depends thus on your use-case.The close() function furthermore allows one to specify which window should be closed. The argument can either be a number or name given to a window when it was created using figure(number_or_name) or it can be a figure instance fig obtained, i.e., usingfig = figure(). If no argument is given to close(), the currently active window will be closed. Furthermore, there is the syntax close('all'), which closes all figures.
http://www.ibm.com/developerworks/cn/linux/l-matplotlib/index.html 这里也有不少可以学习的东西
http://www.w3school.com.cn/xmldom/dom_element.asp
其实无论什么语言,xml的结构和函数就这些,下次就不用绕了。唉,以前用java时,也是老跑这里找,python又到这里,下次就记住点啊,长点记性。
Matplotlib offers three functions:cla() # Clear axis clf() # Clear figure close() # Close a figure windowThe documentation doesn't offer a lot of insight into what the difference between these functions is. When should I use each function and what exactly does it do?
They all do different things, since matplotlib uses a hierarchical order in which a figure window contains a figure which may consist of many axes. The three commands you mention therefore do the following:cla() clears an axis, i.e. the currently active axis in the current figure. It leaves the other axes untouched.clf() clears the entire current figure with all its axes, but leaves the window opened, such that it may be reused for other plots.close() closes a window, which will be the current window, if not specified otherwise.Which functions suits you best depends thus on your use-case.The close() function furthermore allows one to specify which window should be closed. The argument can either be a number or name given to a window when it was created using figure(number_or_name) or it can be a figure instance fig obtained, i.e., usingfig = figure(). If no argument is given to close(), the currently active window will be closed. Furthermore, there is the syntax close('all'), which closes all figures.
http://www.ibm.com/developerworks/cn/linux/l-matplotlib/index.html 这里也有不少可以学习的东西
http://www.w3school.com.cn/xmldom/dom_element.asp
其实无论什么语言,xml的结构和函数就这些,下次就不用绕了。唉,以前用java时,也是老跑这里找,python又到这里,下次就记住点啊,长点记性。
相关文章推荐
- Win7下使用Sublime Text 3开发及调试Maya Mel和Python
- python中偏函数partial用法实例分析
- Python使用bs4获取58同城城市分类的方法
- Python实现批量修改文件名实例
- Python查询阿里巴巴关键字排名的方法
- python 中xrange 和range的用法区别 以及yield的用法
- 浅谈Python中的闭包
- Python中atexit模块的基本使用示例
- python登录豆瓣并发帖的方法
- python格式化输出(转自White Pillow's Blog)
- python版trace命令显示归属地
- Python下opencv使用笔记(三)(图像的几何变换)
- python友情链接检查方法
- 使用python发送html邮件
- eclipse中python文本字体大小设置
- python:使用OpenSSL
- Python抓取百度查询结果的方法
- python初学-01数据类型
- Python抓取淘宝下拉框关键词的方法
- Python笔记:反射(自省)指南