On 6/21/07, Miquel Poch <[EMAIL PROTECTED]> 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.

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()

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to