Index: guitools/PlotPanel.py
===================================================================
--- guitools/PlotPanel.py	(revision 105614c8d6a7fee4b29bd152eaa3571601c125c4)
+++ guitools/PlotPanel.py	(revision df255219074f93dc2db3cb49b26c7b47575a4d3d)
@@ -13,8 +13,11 @@
 from pylab import  gca, gcf
 from plottables import Theory1D
+
+#from matplotlib.backend_bases import MouseEvent
 #from plottables import Data1D
 #TODO: make the plottables interactive
 
 DEBUG = False
+print "hello"
 
 from plottables import Graph
@@ -49,5 +52,4 @@
     #print"this is unit",unit
     return unit
-
 def _rescale(lo,hi,step,pt=None,bal=None,scale='linear'):
         """
@@ -133,4 +135,5 @@
         #self.Bind(EVT_FUNC_FIT, self.onFitRange)
         self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu)
+        
         #self.Bind(EVT_PROPERTY, self._onEVT_FUNC_PROPERTY)
         # Define some constants
@@ -145,4 +148,15 @@
         self.prevYtrans ="y"
         self.canvas.mpl_connect('scroll_event',self.onWheel)
+        #taking care of dragging
+        self.canvas.mpl_connect('motion_notify_event',self.onMouseMotion)
+        self.canvas.mpl_connect('button_press_event',self.onLeftDown)
+        self.canvas.mpl_connect('button_release_event',self.onLeftUp)
+        #self.canvas.mpl_connect('key_press_event',self.onKeyPress)
+       
+        self.leftdown=False
+        self.leftup=False
+        self.mousemotion=False
+        
+        #self.canvas.Bind(wx.EVT_MOUSE_EVENTS,self.onTest)
         self.axes = [self.subplot]
          # new data for the fit 
@@ -160,5 +174,77 @@
         self.ErrBvalue=None
         self.Chivalue=None
-        
+        self.begDrag=False
+        #self.begDragI=False
+        self.xInit=None
+        self.yInit=None
+        self.xFinal=None
+        self.yFinal=None
+   
+    def onLeftDown(self,event): 
+        """ left button down and ready to drag"""
+        self.leftdown=True
+        ax = event.inaxes
+        if ax !=None:
+            x,y = event.x,event.y
+            self.xInit,self.yInit=ax.transAxes.inverse_xy_tup((x,y))
+        
+    def onLeftUp(self,event): 
+        """ Dragging is done """
+        
+        self.leftup=True
+        
+        if self.mousemotion==True:
+            ax = event.inaxes
+            if ax !=None:
+                x,y = event.x,event.y
+                self.xFinal,self.yFinal=ax.transAxes.inverse_xy_tup((x,y))
+                
+                #print "this is xFinal %f this is yFinal %f"%(self.xFinal, self.yFinal)
+                #print "this is xInit %f this is yInit %f"%(self.xInit, self.yInit)
+                #print "this is xdelta %f and ydelta %f"%(xdelta,ydelta)
+                xdelta = self.xFinal -self.xInit
+                ydelta = self.yFinal -self.yInit
+                
+                self.dragHelper(xdelta,ydelta)
+            
+    def onMouseMotion(self,event): 
+        if self.leftdown==True:
+            self.mousemotion=True 
+            
+    def dragHelper(self,xdelta,ydelta):
+        """ dragging occurs here"""
+       
+        # Event occurred inside a plotting area
+        for ax in self.axes:
+            lo,hi= ax.get_xlim()
+            #print "x lo %f and x hi %f"%(lo,hi)
+            newlo,newhi= lo- xdelta, hi- xdelta
+            if self.xscale=='log':
+                if newlo > 0:
+                    newlo= math.log10(newlo)
+                if newhi > 0:
+                    newhi= math.log10(newhi)
+            if self.xscale=='log':
+                ax.set_xlim(math.pow(10,newlo),math.pow(10,newhi))
+            else:
+                ax.set_xlim(newlo,newhi)
+            print "new lo %f and new hi %f"%(newlo,newhi)
+            
+            lo,hi= ax.get_ylim()
+            print "y lo %f and y hi %f"%(lo,hi)
+            newlo,newhi= lo- ydelta, hi- ydelta
+            if self.yscale=='log':
+                if newlo > 0:
+                    newlo= math.log10(newlo)
+                if newhi > 0:
+                    newhi= math.log10(newhi)
+            if  self.yscale=='log':
+                ax.set_ylim(math.pow(10,newlo),math.pow(10,newhi))
+            else:
+                ax.set_ylim(newlo,newhi)
+        self.canvas.draw_idle()
+        
+        
+   
     def resetFitView(self):
         """
@@ -174,5 +260,5 @@
         self.ErrBvalue=None
         self.Chivalue=None
-        
+    
     def onWheel(self, event):
         """
@@ -350,7 +436,4 @@
         self.figure.canvas.draw_idle()
         
-
-  
-  
         
     def onSaveImage(self, evt):
