日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線(xiàn)溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
創(chuàng)新互聯(lián)Python教程:python中subplot函數(shù)怎么畫(huà)圖?

說(shuō)明

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ù)還支持直接輸入一個(gè)三位數(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將會(huì)影響所有的subplot)

sharey: 所有subplot應(yīng)該使用相同的Y軸刻度(調(diào)節(jié)ylim將會(huì)影響所有的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ù)畫(huà)圖的方法,希望對(duì)大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)Python教程

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


文章標(biāo)題:創(chuàng)新互聯(lián)Python教程:python中subplot函數(shù)怎么畫(huà)圖?
URL網(wǎng)址:http://m.5511xx.com/article/cceipog.html