Matplotlib OO + 2 subplot

Hi list,

I need to realize with matplotlib OO same figure as in the tutorial: Working with multiple figure and axe.
The problem is the two subplot are overlaping on the middle of the figure.

There is no margin between the first subplot and the second.
And the vertical axe of the second subplot is overlaping the vertical axe of the first subplot.

How can i solve out this problem?
Thanks a lot,
Philippe Collet

Here is my sample code.
#!/usr/bin/env python
"""
A pure OO (look Ma, no pylab!) example using the agg backend
"""
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot([1,2,3])
ax.set_title("hi mom")
ax.grid(True)
ax.set_xlabel("time")
ax.set_ylabel("volts")

bx = fig.add_subplot(211)
ax.plot([3,4,5])

canvas.print_figure("test2")

Hi Philippe,

philopensource@...32... wrote:

fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)

Here's the problem. The first two numbers of the argument specify the number of rows/cols and all calls of add_subplot of a figure must be euqal in these values. So the two plots should be created like this:

p1 = fig.add_subplot(211)
p2 = fig.add_subplot(212)

Regards, Christian