文章詳情頁
matplotlib - python函數(shù)的問題
瀏覽:130日期: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中一切皆對象
相當(dāng)于給這個對象加了一個attr
回答2:樓上說的沒問題,為什么沒有幫助呢?python中createPlot是函數(shù)同時也是一個對象,python中的對象實(shí)現(xiàn)類似字典類型,為對象動態(tài)添加一個屬性是沒有問題的。
上一條:網(wǎng)頁爬蟲 - python3.4.1 request模塊報錯 ’list’ object has no attribute ’get’下一條:網(wǎng)頁爬蟲 - Python requests.get 爬蟲 設(shè)置代理 IP地址未改變
相關(guān)文章:
1. javascript - 如圖,百度首頁,查看源代碼為什么什么都沒有?2. android - weex 項目createInstanceReferenceError: Vue is not defined3. html - 關(guān)于CSS實(shí)現(xiàn)border的0.5px設(shè)置?4. javascript - 原生APP內(nèi)嵌H5頁面分享到微信朋友圈,二次分享問題。5. javascript - 為什么clearInterVal不起作用呢?6. PHPExcel表格導(dǎo)入數(shù)據(jù)庫怎么導(dǎo)入7. android - 哪位大神知道java后臺的api接口的對象傳到前端后輸入日期報錯,是什么情況?求大神指點(diǎn)8. pdo 寫入到數(shù)據(jù)庫的內(nèi)容為中文的時候?qū)懭雭y碼9. PHP類封裝的插入數(shù)據(jù),總是插入不成功,返回false;10. vue2.0+webpack 如何使用bootstrap?
排行榜

熱門標(biāo)簽