av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)Python教程:python中subplot函數(shù)怎么畫圖?

說明

1、調(diào)用subplot()函數(shù)可以創(chuàng)建子圖,程序可以在子圖上繪制。subplot(nrows、ncols、index、**kwargs)函數(shù)的nrows參數(shù)指定將數(shù)據(jù)圖區(qū)域分成多少行,ncols參數(shù)指定將數(shù)據(jù)圖區(qū)域分成多少列,index參數(shù)指定獲得多少區(qū)域。

2、subplot()函數(shù)還支持直接輸入一個三位數(shù)的參數(shù),其中第一位數(shù)是nrows參數(shù);第二位數(shù)是ncols參數(shù);第三位數(shù)是index參數(shù)。

參數(shù)

nrows:  subplot的行數(shù)

ncols: subplot的列數(shù)

sharex :所有subplot應(yīng)該使用相同的X軸刻度(調(diào)節(jié)xlim將會影響所有的subplot)

sharey: 所有subplot應(yīng)該使用相同的Y軸刻度(調(diào)節(jié)ylim將會影響所有的subplot)

subplot_kw: 用于創(chuàng)建各subplot的關(guān)鍵字字典

**fig_kw: 創(chuàng)建figure時(shí)的其他關(guān)鍵字

實(shí)例

import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 100)
#作圖1
plt.subplot(2,2,1)  #等效于plt.subplot(221)
plt.plot(x, x)
#作圖2
plt.subplot(2,2,2)
plt.plot(x, -x)
#作圖3
plt.subplot(2,2,3)
plt.plot(x, x ** 2)
plt.grid(color='r', linestyle='--', linewidth=1,alpha=0.3)
#作圖4
#plt.subplot(224)
#plt.plot(x, np.log(x))
plt.show()

以上就是python中subplot函數(shù)畫圖的方法,希望對大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)Python教程

本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。


本文名稱:創(chuàng)新互聯(lián)Python教程:python中subplot函數(shù)怎么畫圖?
文章起源:http://uogjgqi.cn/article/cceipog.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流