Several toolbars_NavigationToolbar2Wx

Hi!

I’m trying to embed Matplotlib in wxPython and I find myself in some troubles. I’m sure someone here could help me.

I need an application where plot some functions, three or four graphics at the same time. I’ve done a frame, and with matplotlib I’ve plot two graphs in it. I’ve introduced a toolbar, NavigationToolbar2Wx.

And here is my problem. I can put one toolbar for each graph, but when I make a zoom I want all the graphs change in the same way. That’s possible? I’ve been thinking in make zoom in one graph, and then create a function that receive the data of new axes and resize the other graphs.

Thanks in advance, all suggestions gratefully received!
Miquel

If the axes are in the same figure, you can use the sharex and sharey
properties of the Axes to synchronize the pan/zoom

ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212, sharex=ax1) # share x axis zoom only

but this won't work across figures. I just made some changes to svn
to support this, with new axes methods "sharex_foreign" and
"sharey_foregin" to synchronize x or y views of Axes across different
figures. This example now lives in svn as
examples/shared_axis_across_figures.py

Note I changed the little used and somewhat broken custom Axes
callback handling -- if any of you are using that see the API_CHANGES
notes in svn.

"""
connect the data limits on the axes in one figure with the axes in
another. This is not the right way to do this for two axes in the
same figure -- use the sharex and sharey property in that case
"""
import numpy
from pylab import figure, show

fig1 = figure()
fig2 = figure()

ax1 = fig1.add_subplot(111)
ax2 = fig2.add_subplot(111)

ax1.plot(numpy.random.rand(100), 'o')
ax2.plot(numpy.random.rand(100), 'o')

ax1.sharex_foreign(ax2)
ax2.sharex_foreign(ax1)

ax1.sharey_foreign(ax2)
ax2.sharey_foreign(ax1)
show()

···

On 6/21/07, Miquel Poch <miquel.poch@...287...> wrote:

And here is my problem. I can put one toolbar for each graph, but when I
make a zoom I want all the graphs change in the same way. That's possible?
I've been thinking in make zoom in one graph, and then create a function
that receive the data of new axes and resize the other graphs.