使用Python中的Matplotlib缩放y轴

Rom*_*ass 5 python matplotlib

如何使用Matplotlib缩放y轴?我不想改变y限制,我只是想扩展物理空间.

^      ^
|      |
|      |
+----> |
Before +---->
       After
Run Code Online (Sandbox Code Playgroud)

Aut*_*tic 8

在实例化图形时,只需使用更大的高度值:

from pylab import *
x = linspace(0, 10*pi, 2**10)
y = sin(x)
figure(figsize=(5, 10))
plot(x, y)
show()
Run Code Online (Sandbox Code Playgroud)

在哪里figsize=(width, height)和默认为(8, 6).值以英寸为单位(dpi关键字arg可用于定义图中的DPI,并且matplotlibrc文件中有默认值)

对于已经创建的数字,我相信有一种set_size_inches(width, height)方法.