校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識(shí)庫 > Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比

Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比

熱門標(biāo)簽:外呼系統(tǒng)哪些好辦 沈陽外呼系統(tǒng)呼叫系統(tǒng) 江西省地圖標(biāo)注 沈陽人工外呼系統(tǒng)價(jià)格 武漢外呼系統(tǒng)平臺(tái) 池州外呼調(diào)研線路 如何申請(qǐng)400電話費(fèi)用 富錦商家地圖標(biāo)注 沈陽防封電銷卡品牌

前言:

大家一般都知道subplot可以畫子圖,但是subplots也可以畫子圖,鑒于subplots介紹比較少,這里做一個(gè)對(duì)比,兩者沒有功能一致。

對(duì)比開始:

需求:畫出兩張子圖,在一行顯示,子圖中的內(nèi)容一模一樣

subplot代碼:

ax1 = plt.subplot(1,2,1)
ax1.scatter(positive['X1'], positive['X2'], s=50, marker='x', label='Positive')
ax1.scatter(negative['X1'], negative['X2'], s=50, marker='o', label='Negative')
ax1.legend()#添加圖列就是右上角的點(diǎn)說明
ax2 = plt.subplot(1,2,2)
ax2.scatter(positive['X1'], positive['X2'], s=50, marker='x', label='Positive')
ax2.scatter(negative['X1'], negative['X2'], s=50, marker='o', label='Negative')
ax2.legend()#添加圖列就是右上角的點(diǎn)說明

 

subplots代碼

fig, ax = plt.subplots(figsize=(12,8),ncols=2,nrows=1)#該方法會(huì)返回畫圖對(duì)象和坐標(biāo)對(duì)象ax,figsize是設(shè)置子圖長(zhǎng)寬(1200,800)
ax[0].scatter(positive['X1'], positive['X2'], s=50, marker='x', label='Positive')
ax[0].scatter(negative['X1'], negative['X2'], s=50, marker='o', label='Negative')
ax[0].legend()#添加圖列就是右上角的點(diǎn)說明
ax[1].scatter(positive['X1'], positive['X2'], s=50, marker='x', label='Positive')
ax[1].scatter(negative['X1'], negative['X2'], s=50, marker='o', label='Negative')
ax[1].legend()#添加圖列就是右上角的點(diǎn)說明

對(duì)比結(jié)果:

可以看出來兩者都可以實(shí)現(xiàn)畫子圖功能,只不過subplots幫我們把畫板規(guī)劃好了,返回一個(gè)坐標(biāo)數(shù)組對(duì)象,而subplot每次只能返回一個(gè)坐標(biāo)對(duì)象,subplots可以直接指定畫板的大小。

參考博客:Matplotlib的子圖subplot的使用

參考博客:subplots與figure函數(shù)參數(shù)解釋說明以及簡(jiǎn)單的使用腳本實(shí)例

到此這篇關(guān)于Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比的文章就介紹到這了,更多相關(guān)Matplotlib subplot和subplots內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • matplotlib subplots 設(shè)置總圖的標(biāo)題方法
  • matplotlib subplots 調(diào)整子圖間矩的實(shí)例
  • Matplotlib 生成不同大小的subplots實(shí)例

標(biāo)簽:呂梁 株洲 通遼 黑龍江 常德 潛江 銅川 阿里

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比》,本文關(guān)鍵詞  Matplotlib,實(shí)現(xiàn),subplot,和,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比》相關(guān)的同類信息!
  • 本頁收集關(guān)于Matplotlib實(shí)現(xiàn)subplot和subplots簡(jiǎn)單對(duì)比的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 焦作市| 秦安县| 博爱县| 新巴尔虎左旗| 庆云县| 资兴市| 乐亭县| 鄂温| 祁门县| 敦煌市| 淮阳县| 上高县| 旅游| 乌兰察布市| 襄垣县| 闽清县| 揭阳市| 太康县| 易门县| 田林县| 金阳县| 禹城市| 桓台县| 广安市| 枣强县| 丹阳市| 吉安县| 竹山县| 天门市| 图木舒克市| 左贡县| 天气| 古蔺县| 平和县| 游戏| 开原市| 五指山市| 武功县| 长岭县| 原阳县| 龙陵县|