John,
Thank you for your response.
On Nov 7, 2007 10:13 PM, John Hunter <[EMAIL PROTECTED]> wrote:
> On Nov 7, 2007 7:17 AM, Michael Droettboom <[EMAIL PROTECTED]> wrote:
>
> Michael> I'm not sure what you mean by "can't work on my canvas". Can you
> Michael> provide a small code sample that shows it not working?
(Mike, i'm sorry for that i forgot to send my last response to matplotlib-users)
I meant the plot can't be constrained to x or y axis when I press 'x'
or 'y' key while operating on the pan mode. Panning plot just
relative to 'x' or 'y' axis is what i want.
>
> Here is a reference example in which the x and y constrained panning
> do work in my tests with (GTKAgg and mpl svn), and picking is enabled,
> so you might start and see if this works for you and if not what is
> different about your code. Note that you can only have *either*
> panning and zooming enabled, or picking, but not both at the same
> time, because both compete for the resource of the mouse via the
> widget lock.
Thanks for your example.
The pan mode works normally in the example, as many examples of
matplotlib package.
Yes, Only either panning/zooming or picking is enabled at one time.
> Sunzen> I'm sad to see that there is no answer to my question over these days.
> Sunzen> Active development of matplotlib needs a lot of users.
>
> Absolutely true. We have several active developers, and many more
> users, so developers tend to prioritize their responses to questions
> which provide a clear description of the problem (with version and
> environment information) and more importantly, a code sample so we can
> see whether we can replicate the problem on our end. When a user
> doesn't take the time to prepare such a post so that we can help him
> effectively, we tend to move on.
Thanks for your detailed explanation. I'm sorry for my brief information.
My system is fedora 7. python version is 2.5, and matplotlib version
is 0.90.0.
I try to rebuild a small sample code, which is attached. Amazingly,
the pan mode is normal for this sample code. However, the problem
existing in my application code is still not yet identified.
What's the possible reasons? What kind of further information i should provide?
I'll keep exploration. Thank you for your guidance.
--
sunzen
<<freedom & enjoyment>>
#!/usr/bin/env python
#
import gtk
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
from matplotlib.numerix import *
class BaseView(FigureCanvas):
def __init__(self, numgraphs = 2):
self.axlist = []
self.fig = Figure()
self.axlist.append(self.fig.add_subplot(numgraphs, 1 ,1))
for i in range(2, numgraphs + 1):
self.axlist.append(self.fig.add_subplot(numgraphs, 1 ,i, sharex = self.axlist[0],autoscale_on = False))
FigureCanvas.__init__(self, self.fig)
class ViewOne(BaseView):
def __init__(self):
BaseView.__init__(self, numgraphs = 2)
t = arange(0.0, 2.0, 0.01)
y1 = sin(2*pi*t)
y2 = cos(2*pi*t)
self.axlist[0].plot(t,y1,picker = 5)
self.axlist[1].plot(t,y2,picker = 5)
class testapp():
def __init__(self):
self.window = gtk.Window()
self.window.set_default_size(800,600)
self.vbox = gtk.VBox()
self.window.add(self.vbox)
self.view = ViewOne()
self.vbox.pack_start(self.view, True, True, 0)
navbar = NavigationToolbar(self.view, self.window)
self.vbox.pack_start(navbar, False, False,0)
self.view.mpl_connect('pick_event', self.onpick)
def main(self):
self.window.show_all()
gtk.main()
def onpick(self,event):
picked_axes = event.mouseevent.inaxes
if picked_axes == self.view.axlist[0]:
print "pick in ax[0]"
else:
print "pick in ax[1]"
if __name__ == "__main__":
app = testapp()
app.main()
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users