# Scale subplot plots?

I've looked in both the examples and the docs, and have yet to find a
clear way of accomplishing the following:

I have a plot with two subplots:

-----------------------------------|
>
>
-----------------------------------|
>
>
>

. .
. .

That is, I want the top subplot (which shows aggregate data, using the
same x-axis) to always be, say, 80 pix high, and the bottom subplot
to scale with the number of things (in this case, sparkline-like
timelines) I add to it. So there's not a constant ratio between
the top and bottom subplots. Might anyone be able to point me in the
right direction, either to an explicit example or someplace in the
docs?

Thanks!
...Eric Jonas

I'm afraid that you may not be able to do those with the subplot.
If you want a fixed size axes, you need to manually calculate the axes
position (in normalized figure coordinates) using the figure size.

You may use my helper class which support a fixed-size axes.

http://dl.getdropbox.com/u/178748/mpl/axes_divider.py

import matplotlib.pyplot as plt
from axes_divider import make_axes_locatable

fig1 = plt.figure(1, (6, 6))

divider = make_axes_locatable(ax)
# make a new axes with fixed height (1 inch) above ax
ax2 = divider.new_vertical(size=1, pad=0.1, sharex=ax) # size in inches

plt.show()

Regardless of the figure size, ax2 will always have 1 inch height and
ax will have the rest of the subplot area.

Regards,
-JJ

···

On Thu, Jan 15, 2009 at 1:14 PM, Eric Jonas <jonas@...1166...> wrote:

I've looked in both the examples and the docs, and have yet to find a
clear way of accomplishing the following:

I have a plot with two subplots:

>-----------------------------------|
> >
> >
>-----------------------------------|
> >
> >
> >
. .
. .

That is, I want the top subplot (which shows aggregate data, using the
same x-axis) to always be, say, 80 pix high, and the bottom subplot
to scale with the number of things (in this case, sparkline-like
timelines) I add to it. So there's not a constant ratio between
the top and bottom subplots. Might anyone be able to point me in the
right direction, either to an explicit example or someplace in the
docs?

Thanks!
...Eric Jonas

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.