代码之家  ›  专栏  ›  技术社区  ›  user469652

关于从matplotlib生成的图像大小

  •  1
  • user469652  · 技术社区  · 14 年前

    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()
    

    我想把照片缩小一点,我怎么能这样做呢?

    谢谢你的帮助

    2 回复  |  直到 14 年前
        1
  •  4
  •   Justin Peel    14 年前

    如果您只想为这个特定的图形设置它,那么将您的图形声明更改为:

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

        2
  •  0
  •   user488551    14 年前

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