views:

1004

answers:

2

Does anybody know how to scale the y-axis with matplotlib? I don't want to change the y-limit, I just want to extend the physical space.

^      ^
|      |
|      |
+----> |
Before +---->
       After

Thanks!

+3  A: 

just use a larger height value when you instantiate the figure:

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

where figsize=(width, height) and defaults to (8, 6). values are in inches (the dpi keyword arg can be used to define the dpi for the figure, and there's a default value in your matplotlibrc file)

for a figure already created, i believe there is a set_size_inches(width, height) method.

Autoplectic
Sometimes it is better to try something :) 'figure' did the right job. Thank you very much!
Roman Glass
+2  A: 

Use the subplots_adjust function to control the abount of whitespace:

fig.subplots_adust(bottom=0.05, top=0.95)

There is an icon on the toolbar to do this interactively with a widget

Thanks, this works for me, since it just resizes the plot area, i.e. I can make extra space for the xticks.
Yang