Hi!
I have two datasets with different data coordinates, which I want to plot on
different subplots, all showing the same extent. I want to be able to zoom
into one of the subplots, and have the other follow (through some conversion
of the former's extent).
Initially, I just want one plot to follow the other (but I could easily
extend that to both plots if needs be). The code works, but I cannot update
my plots automatically, although I call  pylab.draw(). What's the way to
have my plots respond to my events without dragging the window borders,
resizing the window, etc? I am using matplotlib 0.90.1 and GTKAgg backend on
Linux. Here's some code snippet of what I am doing:

fig=pylab.figure()
ax =fig.add_subplot(211)
xtent1=(1111950.520,3335851.559,-2223901.039,-1111950.520)
xtent2=(0,2477,0,2319 )
im1=ax.imshow( image1,extent=xtent1,picker=True)
ax2=fig.add_subplot(212)
im2=ax2.imshow( image2)
ax2.set_xlim (1073, 1797)
ax2.set_ylim (1944, 1588)
pylab.draw()
def pick_new_extent(event):
        artist = event.artist
        (xlow,xhigh) = artist.get_axes().get_xlim()
        (ylow,yhigh) = artist.get_axes().get_ylim()
        [xmin, xmax, ymin, ymax] = CalculateWindowCoordinates(xlow, xhigh,
ylow, yhigh) #This does the coordinate transformation

        ax2.set_xlim(xmin,xmax)
        ax2.set_ylim(ymax, ymin)
        pylab.draw() #Why doesn't the window refresh when it gets here? I
need to change the window size to get it to refresh!!
fig.canvas.mpl_connect('pick_event', pick_new_exent)

Thanks!
Jose

-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to