Index: plottools/src/danse/common/plottools/PlotPanel.py
===================================================================
--- plottools/src/danse/common/plottools/PlotPanel.py	(revision 8d27cacc9b29b497ac295afb6f6125555a07cda4)
+++ plottools/src/danse/common/plottools/PlotPanel.py	(revision 0e553fd2808f3d9036eef66181f51921babd5081)
@@ -119,4 +119,8 @@
         wx.Panel.__init__(self, parent, id=id, **kwargs)
         self.parent = parent
+        self.gotLegend = 0  #to begin, legend is not picked. 
+        self.legend_pos_loc = None
+        self.legend = None
+        self.line_collections_list = [] 
         self.figure = Figure(None, dpi, linewidth=2.0)
         self.color = '#b3b3b3'  
@@ -126,5 +130,5 @@
         #self.SetBackgroundColour(parent.GetBackgroundColour())
         self._resizeflag = True
-        self._SetSize()
+        self._SetInitialSize() 
         self.subplot = self.figure.add_subplot(111)
         self.figure.subplots_adjust(left=0.2, bottom=.2)
@@ -178,5 +182,7 @@
         self.canvas.mpl_connect('motion_notify_event', self.onMouseMotion)
         self.canvas.mpl_connect('button_press_event', self.onLeftDown)
+        self.canvas.mpl_connect('pick_event', self.onPick)
         self.canvas.mpl_connect('button_release_event', self.onLeftUp)
+        
         wx.EVT_RIGHT_DOWN(self, self.onLeftDown)
         # to turn axis off whenn resizing the panel
@@ -192,5 +198,5 @@
         self.connect = BindArtist(self.subplot.figure)
         #self.selected_plottable = None
-
+        
         # new data for the fit 
         self.fit_result = Data1D(x=[], y=[], dy=None)
@@ -264,8 +270,17 @@
         # let canvas know about axes
         self.canvas.set_panel(self)
-        #Bind focus to change the border color       
+        
+        #Bind focus to change the border color      
         self.canvas.Bind(wx.EVT_SET_FOCUS, self.on_set_focus)
         self.canvas.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
-        
+
+    def _SetInitialSize(self,):
+        """
+        """
+        pixels = self.parent.GetClientSize()
+        self.canvas.SetSize(pixels)
+        self.figure.set_size_inches( (pixels[0])/self.figure.get_dpi(),
+         (pixels[1])/self.figure.get_dpi(), forward=True )   
+          
     def On_Paint(self, event):
         """
@@ -369,5 +384,70 @@
             self.mousemotion = False 
             self.leftup = True
-        
+            
+        #release the legend    
+        if self.gotLegend == 1:
+            self.gotLegend = 0
+            self.set_legend_alpha(1)
+            
+    def set_legend_alpha(self, alpha=1):
+        """
+        Set legend alpha
+        """
+        if self.legend != None:
+            self.legend.legendPatch.set_alpha(alpha)
+        
+    def onPick(self, event):    
+        """
+        On pick legend
+        """
+        legend = self.legend
+        if event.artist == legend:
+            #gets the box of the legend.
+            bbox = self.legend.get_window_extent()  
+            #get mouse coordinates at time of pick.
+            self.mouse_x = event.mouseevent.x  
+            self.mouse_y = event.mouseevent.y
+            #get legend coordinates at time of pick.
+            self.legend_x = bbox.xmin          
+            self.legend_y = bbox.ymin
+            #indicates we picked up the legend.
+            self.gotLegend = 1   
+            self.set_legend_alpha(0.5)
+  
+            
+    def _on_legend_motion(self, event): 
+        """
+        On legend in motion
+        """
+        ax = event.inaxes
+        if ax == None:
+            return
+        # Event occurred inside a plotting area
+        lo_x, hi_x = ax.get_xlim()
+        lo_y, hi_y = ax.get_ylim()
+        # How much the mouse moved.
+        x = mouse_diff_x = self.mouse_x - event.x  
+        y = mouse_diff_y = self.mouse_y - event.y
+        # Put back inside
+        if x < lo_x:
+            x = lo_x
+        if x > hi_x:
+            x = hi_x
+        if y < lo_y:
+            y = lo_y
+        if y> hi_y:
+            y = hi_y
+        # Move the legend from its previous location by that same amount
+        loc_in_canvas = self.legend_x - mouse_diff_x, \
+                        self.legend_y - mouse_diff_y
+        # Transform into legend coordinate system
+        trans_axes = self.legend.parent.transAxes.inverted()
+        loc_in_norm_axes = trans_axes.transform_point(loc_in_canvas)
+        self.legend_pos_loc = tuple(loc_in_norm_axes)
+        self.legend._loc = self.legend_pos_loc
+        self.resizing = True
+        self.canvas.set_resizing(self.resizing)
+        self.canvas.draw() 
+           
     def onMouseMotion(self, event): 
         """
@@ -377,4 +457,7 @@
         
         """
+        if self.gotLegend == 1:
+            self._on_legend_motion(event)
+            return
         if self.enable_toolbar:
             #Disable dragging without the toolbar to allow zooming with toolbar
@@ -400,4 +483,5 @@
             else:# no dragging is perform elsewhere
                 self._dragHelper(0,0)
+
                 
     def _offset_graph(self):
@@ -701,8 +785,8 @@
         """
         if not pixels:
-            pixels = self.GetClientSize()
+            pixels = tuple(self.GetClientSize())
         self.canvas.SetSize(pixels)
-        self.figure.set_size_inches(pixels[0]/self.figure.get_dpi(),
-        pixels[1]/self.figure.get_dpi())
+        self.figure.set_size_inches( float( pixels[0] )/self.figure.get_dpi(),
+                                     float( pixels[1] )/self.figure.get_dpi() ) 
 
     def draw(self):
@@ -713,4 +797,8 @@
         self.figure.canvas.draw_idle()
         
+       
+    #pick up the legend patch
+    def legend_picker(self, legend, event):
+        return self.legend.legendPatch.contains(event)      
         
     def get_loc_label(self):
@@ -846,7 +934,11 @@
                         key=operator.itemgetter(1))
             handles2, labels2 = zip(*hl)
-            self.subplot.legend(handles2, labels2, 
+            self.line_collections_list = handles2
+            self.legend = self.subplot.legend(handles2, labels2, 
                                 prop=FontProperties(size=10), numpoints=1,
                                 handletextsep=.05, loc=self.legendLoc)
+            if self.legend != None:
+                self.legend.set_picker(self.legend_picker) 
+                self.legend.set_axes(self.subplot) 
         
         self.subplot.figure.canvas.draw_idle()       
@@ -862,4 +954,5 @@
         
         self.legendLoc = label
+        self.legend_pos_loc = None
         # sort them by labels
         handles, labels = self.subplot.get_legend_handles_labels()
@@ -867,7 +960,11 @@
                     key=operator.itemgetter(1))
         handles2, labels2 = zip(*hl)
-        self.subplot.legend(handles2, labels2, 
+        self.line_collections_list = handles2
+        self.legend = self.subplot.legend(handles2, labels2, 
                             prop=FontProperties(size=10),  numpoints=1,
                             handletextsep=.05, loc=self.legendLoc)
+        if self.legend != None:
+                self.legend.set_picker(self.legend_picker) 
+                self.legend.set_axes(self.subplot) 
         self.subplot.figure.canvas.draw_idle()  
         #self._onEVT_FUNC_PROPERTY()
@@ -1118,11 +1215,16 @@
                             key=operator.itemgetter(1))
                 handles2, labels2 = zip(*hl)
-                leg = ax.legend(handles2, labels2,  numpoints=1,
+                self.line_collections_list = handles2
+                self.legend = ax.legend(handles2, labels2,  numpoints=1,
                                 prop=FontProperties(size=10), 
                                 handletextsep=.05, loc=self.legendLoc)
+                if self.legend != None:
+                    self.legend.set_picker(self.legend_picker)
+                    self.legend.set_axes(self.subplot) 
+                
             except:
-                leg = ax.legend(prop=FontProperties(size=10),  numpoints=1,
+                self.legend = ax.legend(prop=FontProperties(size=10),  numpoints=1,
                                 handletextsep=.05, loc=self.legendLoc)
-                
+                 
     def xaxis(self, label, units, font=None, color='black'):
         """xaxis label and units.
@@ -1636,5 +1738,5 @@
             if(self.yLabel == "y*x^(4)"):
                 item.transformY(transform.toYX4, transform.errToYX4)
-                xunits = convertUnit(4, xunits) 
+                xunits = convertUnit(4, self.xaxis_unit) 
                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname,xname), 
                                                "%s%s" % (yunits,xunits))
@@ -1647,18 +1749,18 @@
                 item.transformY(transform.toLogXY, transform.errToLogXY)
                 self.graph._yaxis_transformed("\ln (%s \ \ %s)" % (yname,xname),
-                                                "%s%s" % (yunits, xunits))
+                                                "%s%s" % (yunits, self.xaxis_unit))
             if(self.yLabel == "ln(y*x^(2))"):
                 item.transformY( transform.toLogYX2, transform.errToLogYX2) 
-                xunits = convertUnit(2,xunits) 
+                xunits = convertUnit(2, self.xaxis_unit) 
                 self.graph._yaxis_transformed("\ln (%s \ \ %s^{2})" % (yname,xname), 
                                                "%s%s" % (yunits,xunits))
             if(self.yLabel == "ln(y*x^(4))"):
                 item.transformY(transform.toLogYX4, transform.errToLogYX4)
-                xunits = convertUnit(4, xunits) 
+                xunits = convertUnit(4, self.xaxis_unit) 
                 self.graph._yaxis_transformed("\ln (%s \ \ %s^{4})" % (yname,xname), 
                                                "%s%s" % (yunits,xunits))
             if(self.yLabel == "log10(y*x^(4))"):
                 item.transformY(transform.toYX4, transform.errToYX4)
-                xunits = convertUnit(4, xunits) 
+                xunits = convertUnit(4, self.xaxis_unit) 
                 _yscale = 'log' 
                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname,xname), 
Index: plottools/src/danse/common/plottools/binder.py
===================================================================
--- plottools/src/danse/common/plottools/binder.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/binder.py	(revision 0e553fd2808f3d9036eef66181f51921babd5081)
@@ -68,9 +68,9 @@
 
         # Turn off picker if it hasn't already been done
-        try:
-            canvas.mpl_disconnect(canvas.button_pick_id)
-            canvas.mpl_disconnect(canvas.scroll_pick_id)
-        except: 
-            pass
+        #try:
+        #    canvas.mpl_disconnect(canvas.button_pick_id)
+        #    canvas.mpl_disconnect(canvas.scroll_pick_id)
+        #except: 
+        #    pass
         self._current = None
         self._actions = {}
Index: plottools/src/danse/common/plottools/canvas.py
===================================================================
--- plottools/src/danse/common/plottools/canvas.py	(revision 82a54b89c2fb14de05cf41239d597f5e7cb6df9b)
+++ plottools/src/danse/common/plottools/canvas.py	(revision 0e553fd2808f3d9036eef66181f51921babd5081)
@@ -148,4 +148,6 @@
         """
         self.panel.subplot.grid(self.panel.grid_on)
+        if self.panel.legend_pos_loc:
+            self.panel.legend._loc = self.panel.legend_pos_loc
         self.idletimer.Restart(5, *args, **kwargs)  # Delay by 5 ms
 
@@ -182,5 +184,5 @@
         self.resizing = resizing
         self.panel.set_resizing(False)
-        
+             
     def draw(self, drawDC=None):
         """
