开发者

About the image size that generated from matplotlib

开发者 https://www.devze.com 2023-01-21 14:32 出处:网络
I generated a histogram by using matplotlib import numpy as np import pylab as P mu, sigma = 200, 25 x = mu + sigma*P.randn(10000)

I generated a histogram by using 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()

I want to 开发者_如何学Gomake the picture smaller, how could I do that?

Thanks for your help


If you just want to set it for this specific figure, then change your figure declaration to:

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

where i is the width in inches and j is the height in inches.


In addition to specifying the figsize, there's also a dpi option - although this is more important if you're using one of the image generating backends.

0

精彩评论

暂无评论...
验证码 换一张
取 消