Python 关于从matplotlib生成的图像大小

Python 关于从matplotlib生成的图像大小,python,matplotlib,Python,Matplotlib,我使用matplotlib生成了一个直方图 import numpy as np import pylab as P mu, sigma = 200, 25 x = mu + sigma*P.randn(10000) P.figure() bins = 10 n, bins, patches = P.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) P.show() 我想把图片缩小一点,我怎么能做到呢 感谢您的帮助如果您只想为此特定

我使用matplotlib生成了一个直方图

import numpy as np
import pylab as P


mu, sigma = 200, 25
x = mu + sigma*P.randn(10000)


P.figure()
bins = 10
n, bins, patches = P.hist(x, bins, normed=1, histtype='bar', rwidth=0.8)
P.show()
我想把图片缩小一点,我怎么能做到呢


感谢您的帮助

如果您只想为此特定地物进行设置,请将地物声明更改为:

P.figure(figsize=(i,j))

其中i是以英寸为单位的宽度,j是以英寸为单位的高度。

如果您只想为该特定图形设置它,请将图形声明更改为:

P.figure(figsize=(i,j))

其中i是以英寸为单位的宽度,j是以英寸为单位的高度。

除了指定figsize外,还有一个dpi选项-尽管如果使用一个图像生成后端,这一点更为重要。

除了指定figsize,还有一个dpi选项——尽管如果您使用的是图像生成后端,这一点更为重要