zoomhistory, zoom to rectangle

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

zoomhistory, zoom to rectangle

Martin Richter
Hello,

one of Matplotlib's greatest advantage (besides the great graphics of
course) is the ability to zoom in into plotted curves. The zoomhistory is
thereby a very good and useful tool.
I figured out two things:

1) Unfortunetly this history seems not to work properly in some cases. I
was able to track down this error on the call of the subplot-command (see
example below).
Is this a little bug or am I using those commands in a way they are not
supposed to be used?

2) If the built-in zoomfunction "zoom to rectangle" is used too "hectic"
(i.e. the mouse is still moving when the button is released) the zoom is
done but not shown. Therefor one can see the just drawn
rectangles.

Bye,
Martin

#-----------------------------------------------------------------------------------
"""This program shows how the zoom-history is messed up by the usage of the
   subplot-command.
"""

from pylab import *

def click(event):
    """Plot a point.
    """
    if event.inaxes==subplot1 and event.button==1:
        x,y = event.xdata,event.ydata
        subplot(121,autoscale_on=False)
    # If those subplot-commands are commented out
    # the zoom-history will work properly.
    # (i.e. the home-function is defective,
    # only steps back untill the last click(event)-call
    # are possible.)
        plot([x],[y],'ro')
        subplot(122,autoscale_on=False)
        plot([x],[y],'go')
        draw()

t=arange(100)/99.0
subplot2 = subplot(122,autoscale_on=False)
plot(t,.5*(sin(2*pi*t)+1))
subplot1 = subplot(121,autoscale_on=False)
plot(t,t**2)
axis([0,1,0,1])
connect('button_press_event',click)
show()

--
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse f?r Mail, Message, More +++


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...