久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解

瀏覽:40日期:2022-08-02 11:59:42

我就廢話不多說啦!

dpi=1 600×400

dpi=21200×800

dpi=31800×1200

........

dpi=21(21×600)×(21×400) ---> 12600×8400

示例代碼:

.............................. plt_temp=y_axis plt_temp.resize(len(y_axis) , 1) plt_arr=np.concatenate((plt_arr,plt_temp ), axis=1) #print(self.plt_arr) if plt_x%1000==0:print(plt_x) if plt_x%1000==0:cm=’hot’norm = matplotlib.colors.Normalize(vmin=min, vmax=max) map=plt.imshow(plt_arr,interpolation=’nearest’,cmap=cm,norm=norm, origin=’upper’)plt.xticks([])plt.yticks([])plt.axis(’off’)#plt.colorbar(mappable=map,ax=None,shrink=0.5, pad=0)plt.savefig('filename.png', dpi=1320) # 加參數(shù) ,bbox_inches=’tight’ ,pad_inches=0 可以得到窄邊框圖片#plt.show()print(plt_x) plt_x+=1 temp_str=str(num_now) return donser_now_lable........................

上代碼讀入一個二進(jìn)制bin數(shù)據(jù)文件1.08GB的一部分,數(shù)據(jù)格式為無包頭、小端模式、16位編碼的頻譜數(shù)據(jù)dpi=1320,生成名稱為filename.png的圖片

python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解

補(bǔ)充知識:Python繪圖問題:Matplotlib中指定圖片大小

我們在用Matplotlib畫圖的時候可能會遇到當(dāng)在一張面板上顯示太多的圖片時,plt.show出來就會顯示的很小

像下圖的樣子

python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解

這時候用改變子圖片間距的方法也解決不了問題:

plt.subplots_adjust(wspace=0.1, hspace=0.2)

于是我們用

plt. figure(figsize=(5,8))# 可以按5比8的大致 比例增加來增大圖片的像素# 例如 plt. figure(figsize=(10,16))

里面的參數(shù)第一個5應(yīng)該是5列,8是8行,如果不行就是試著換成別的參數(shù) 但是需要按照大概的比例

python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解

按比例增加參數(shù)大小以后:

python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解

這樣就好多了!

以上這篇python matplotlib 繪圖 和 dpi對應(yīng)關(guān)系詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 察隅县| 兴宁市| 邹城市| 察雅县| 连城县| 图片| 曲麻莱县| 龙井市| 天祝| 屏东县| 嵩明县| 莆田市| 民县| 克什克腾旗| 昌乐县| 西城区| 剑川县| 明溪县| 紫金县| 梓潼县| 东宁县| 长沙市| 汝南县| 罗源县| 华容县| 三明市| 太康县| 隆德县| 赤峰市| 门头沟区| 聂拉木县| 昌平区| 岐山县| 呼伦贝尔市| 靖边县| 绥宁县| 双江| 汽车| 武夷山市| 耒阳市| 竹溪县|