文章详情页
matplotlib - python函数的问题
浏览:270日期:2022-06-29 13:00:17
问题描述
def createPlot(): fig = plt.figure(1, facecolor = ’white’) fig.clf() createPlot.ax1 = plt.subplot(111, frameon = False) plotNode(’nonLeafNode’, (0.2, 0.1), (0.4, 0.8), nonLeafNodes) plotNode(’LeafNode’, (0.8, 0.1), (0.6, 0.8), leafNodes) plt.show()createPlot()
代码里的createPlot.ax1是什么意思?之前没见过这么用过,请教了!
问题解答
回答1:python中一切皆对象

相当于给这个对象加了一个attr
回答2:楼上说的没问题,为什么没有帮助呢?python中createPlot是函数同时也是一个对象,python中的对象实现类似字典类型,为对象动态添加一个属性是没有问题的。
上一条:网页爬虫 - python3.4.1 request模块报错 ’list’ object has no attribute ’get’下一条:网页爬虫 - Python requests.get 爬虫 设置代理 IP地址未改变
相关文章:
1. python - 用ffmpeg采集视频,用terminate没法结束进程2. react-native 启动Android项目失败3. nginx - 关于vue项目部署到ngnix后出现的问题4. java - 为什么第一个线程已经释放了锁,第二个线程却不行?5. python中merge后文件莫名变得非常大6. gosts内容是空的7. javascript - 手机点击input时,button会被顶上去?求解决!!!8. html - css导航栏模糊,导航栏固定,随着页面滑动对下方页面产生模糊效果,如何实现?9. css - 关于HTML中width和height的疑问(这个提问的标题不好起)10. linux - python 安装 Anaconda 环境变量问题请教
排行榜

网公网安备