Pan/Zoom with Matplotlib
Czenek
czenek at gmail.com
Sat Oct 18 07:55:05 EDT 2008
On Oct 18, 1:48 am, Czenek <cze... at gmail.com> wrote:
> Hi,
> can I use somehow standard matplotlib's functions pan/zoom? I would
> like to zoom my created graph after double-clicking and move with it
> after keyboard (arrow) pressing (similar as Google Maps). And I want
> also to control how much it zooms and how far is the graph moved after
> pressing a key (or double-clicking).
> So are there any appropriate API functions which can be connected with
> keyboard and mouse events?
>
> Thanks
> Czenek
>
> PS: I'd like to use it with tk.
And
import matplotlib as mpl
f=mpl.figure(figsize(5,5),dpi=100)
sbplt=f.add_subplot(111)
...
while 1:
x1,x2=sbplt.get_xlim()
y1,y2=sbplt.get_ylim()
sbplt.set_xlim(x1+0.1,x2+0.1)
sbplt.set_ylim(y1+0.1,y2+0.1)
f.canvas.draw()
this works pretty well on Linux, but the movement on Windows is slow
and therefore it is not smooth.
Any advice for better smoothness?
Czenek
More information about the Python-list
mailing list