Index: src/sas/plottools/PlotPanel.py
===================================================================
--- src/sas/plottools/PlotPanel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/plottools/PlotPanel.py	(revision 121f72cc5a87a31405efdc1ea930467b43f2eabf)
@@ -1,3 +1,4 @@
 """
+    Plot panel.
 """
 import logging
@@ -31,4 +32,5 @@
 import numpy
 
+from sas.guiframe.events import StatusEvent
 
 def show_tree(obj, d=0):
@@ -36,54 +38,54 @@
     print "%s%s" % ("-"*d, obj.__class__.__name__)
     if 'get_children' in dir(obj):
-        for a in obj.get_children(): show_tree(a, d+1)
-     
+        for a in obj.get_children(): show_tree(a, d + 1)
+
 from unitConverter import UnitConvertion as convertUnit
 
 
 def _rescale(lo, hi, step, pt=None, bal=None, scale='linear'):
-        """
+    """
         Rescale (lo,hi) by step, returning the new (lo,hi)
         The scaling is centered on pt, with positive values of step
         driving lo/hi away from pt and negative values pulling them in.
         If bal is given instead of point, it is already in [0,1] coordinates.
-    
+
         This is a helper function for step-based zooming.
-        
-        """
-        # Convert values into the correct scale for a linear transformation
-        # TODO: use proper scale transformers
-        loprev = lo
-        hiprev = hi
-        if scale == 'log':
-            assert lo > 0
-            if lo > 0:
-                lo = math.log10(lo)
-            if hi > 0:
-                hi = math.log10(hi)
-            if pt is not None:
-                pt = math.log10(pt)
-        
-        # Compute delta from axis range * %, or 1-% if persent is negative
-        if step > 0:
-            delta = float(hi - lo) * step / 100
+
+    """
+    # Convert values into the correct scale for a linear transformation
+    # TODO: use proper scale transformers
+    loprev = lo
+    hiprev = hi
+    if scale == 'log':
+        assert lo > 0
+        if lo > 0:
+            lo = math.log10(lo)
+        if hi > 0:
+            hi = math.log10(hi)
+        if pt is not None:
+            pt = math.log10(pt)
+
+    # Compute delta from axis range * %, or 1-% if persent is negative
+    if step > 0:
+        delta = float(hi - lo) * step / 100
+    else:
+        delta = float(hi - lo) * step / (100 - step)
+
+    # Add scale factor proportionally to the lo and hi values,
+    # preserving the
+    # point under the mouse
+    if bal is None:
+        bal = float(pt - lo) / (hi - lo)
+    lo = lo - (bal * delta)
+    hi = hi + (1 - bal) * delta
+
+    # Convert transformed values back to the original scale
+    if scale == 'log':
+        if (lo <= -250) or (hi >= 250):
+            lo = loprev
+            hi = hiprev
         else:
-            delta = float(hi - lo) * step / (100 - step)
-    
-        # Add scale factor proportionally to the lo and hi values,
-        # preserving the
-        # point under the mouse
-        if bal is None:
-            bal = float(pt - lo) / (hi - lo)
-        lo = lo - (bal * delta)
-        hi = hi + (1 - bal) * delta
-    
-        # Convert transformed values back to the original scale
-        if scale == 'log':
-            if (lo <= -250) or (hi >= 250):
-                lo = loprev
-                hi = hiprev
-            else:
-                lo, hi = math.pow(10., lo), math.pow(10., hi)
-        return (lo, hi)
+            lo, hi = math.pow(10., lo), math.pow(10., hi)
+    return (lo, hi)
 
 
@@ -96,5 +98,5 @@
     bmp = wx.BitmapDataObject()
     bmp.SetBitmap(canvas.bitmap)
-    
+
     wx.TheClipboard.Open()
     wx.TheClipboard.SetData(bmp)
@@ -104,12 +106,11 @@
 class PlotPanel(wx.Panel):
     """
-    The PlotPanel has a Figure and a Canvas. OnSize events simply set a 
+    The PlotPanel has a Figure and a Canvas. OnSize events simply set a
     flag, and the actually redrawing of the
     figure is triggered by an Idle event.
-    
     """
     def __init__(self, parent, id=-1, xtransform=None,
-                  ytransform=None, scale='log_{10}',
-                  color=None, dpi=None, **kwargs):
+                 ytransform=None, scale='log_{10}',
+                 color=None, dpi=None, **kwargs):
         """
         """
@@ -128,5 +129,4 @@
         self.canvas = FigureCanvas(self, -1, self.figure)
         self.SetColor(color)
-        #self.SetBackgroundColour(parent.GetBackgroundColour())
         self._resizeflag = True
         self._SetSize()
@@ -142,8 +142,8 @@
         self.add_toolbar()
         self.SetSizer(self.sizer)
-        
+
         # Graph object to manage the plottables
         self.graph = Graph()
-        
+
         #Boolean value to keep track of whether current legend is
         #visible or not
@@ -154,12 +154,12 @@
         self.position = None
         self._loc_labels = self.get_loc_label()
-      
+
         self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu)
-        
+
         # Define some constants
-        self.colorlist = ['b','g','r','c','m','y','k']
-        self.symbollist = ['o','x','^','v','<','>','+',
-                           's','d','D','h','H','p', '-']
-        
+        self.colorlist = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
+        self.symbollist = ['o', 'x', '^', 'v', '<', '>', '+',
+                           's', 'd', 'D', 'h', 'H', 'p', '-']
+
         #List of texts currently on the plot
         self.textList = []
@@ -180,16 +180,16 @@
         self.scroll_id = self.canvas.mpl_connect('scroll_event', self.onWheel)
         #taking care of dragging
-        self.motion_id = self.canvas.mpl_connect('motion_notify_event', 
+        self.motion_id = self.canvas.mpl_connect('motion_notify_event',
                                                  self.onMouseMotion)
-        self.press_id = self.canvas.mpl_connect('button_press_event', 
+        self.press_id = self.canvas.mpl_connect('button_press_event',
                                                 self.onLeftDown)
         self.pick_id = self.canvas.mpl_connect('pick_event', self.onPick)
-        self.release_id = self.canvas.mpl_connect('button_release_event', 
+        self.release_id = self.canvas.mpl_connect('button_release_event',
                                                   self.onLeftUp)
-        
+
         wx.EVT_RIGHT_DOWN(self, self.onLeftDown)
         # to turn axis off whenn resizing the panel
         self.resizing = False
-        
+
         self.leftdown = False
         self.leftup = False
@@ -201,5 +201,5 @@
         self.connect = BindArtist(self.subplot.figure)
         #self.selected_plottable = None
-        
+
         # new data for the fit
         self.fit_result = Data1D(x=[], y=[], dy=None)
@@ -221,5 +221,5 @@
         self.ErrBvalue = None
         self.Chivalue = None
-        
+
         # for 2D scale
         if scale != 'linear':
@@ -237,16 +237,16 @@
         self.zmin_2D = None
         self.zmax_2D = None
-        
+
         #index array
         self.index_x = None
         self.index_y = None
-        
+
         #number of bins
         self.x_bins = None
         self.y_bins = None
-        
+
         ## default color map
         self.cmap = DEFAULT_CMAP
-       
+
         # Dragging info
         self.begDrag = False
@@ -255,5 +255,5 @@
         self.xFinal = None
         self.yFinal = None
-        
+
         #axes properties
         self.xaxis_font = None
@@ -267,10 +267,10 @@
         self.yaxis_color = 'black'
         self.yaxis_tick = None
-        
+
         # check if zoomed.
         self.is_zoomed = False
         # Plottables
         self.plots = {}
-        
+
         # Default locations
         self._default_save_location = os.getcwd()
@@ -289,6 +289,6 @@
         self.canvas.SetSize(pixels)
         self.figure.set_size_inches(pixels[0] / self.figure.get_dpi(),
-         pixels[1] / self.figure.get_dpi(), forward=True)
-          
+                                    pixels[1] / self.figure.get_dpi(), forward=True)
+
     def On_Paint(self, event):
         """
@@ -306,5 +306,5 @@
             self.parent.send_focus_to_datapanel(self.window_caption)
         self.draw()
-        
+
     def on_kill_focus(self, event):
         """
@@ -315,5 +315,5 @@
         self.figure.set_edgecolor(self.color)
         self.draw()
-           
+
     def set_resizing(self, resizing=False):
         """
@@ -321,5 +321,5 @@
         """
         pass  # Not implemented
-    
+
     def schedule_full_draw(self, func='append'):
         """
@@ -327,5 +327,5 @@
         """
         pass  # Not implemented
-    
+
     def add_toolbar(self):
         """
@@ -352,12 +352,11 @@
         self.toolbar.SetSize(wx.Size(fw, th))
         self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
-        
+
         # update the axes menu on the toolbar
         self.toolbar.update()
-        
+
     def onLeftDown(self, event):
         """
         left button down and ready to drag
-        
         """
         # Check that the LEFT button was pressed
@@ -386,10 +385,10 @@
             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):
         """
@@ -398,5 +397,5 @@
         if self.legend != None:
             self.legend.legendPatch.set_alpha(alpha)
-        
+
     def onPick(self, event):
         """
@@ -416,5 +415,5 @@
             self.gotLegend = 1
             self.set_legend_alpha(0.5)
-    
+
     def _on_legend_motion(self, event):
         """
@@ -450,5 +449,5 @@
         self.canvas.set_resizing(self.resizing)
         self.canvas.draw()
-           
+
     def onMouseMotion(self, event):
         """
@@ -456,5 +455,4 @@
         computer delta for x and y coordinates and then calls draghelper
         to perform the drag
-        
         """
         self.cusor_line(event)
@@ -474,8 +472,8 @@
                     self.xInit = self.xFinal
                     self.yInit = self.yFinal
-                    
+
                 xdelta = self.xFinal - self.xInit
                 ydelta = self.yFinal - self.yInit
-                
+
                 if self.xscale == 'log':
                     xdelta = math.log10(self.xFinal) - math.log10(self.xInit)
@@ -500,14 +498,12 @@
             if self._scale_yhi is not None and self._scale_ylo is not None:
                 ax.set_ylim(self._scale_ylo, self._scale_yhi)
-            
+
     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':
@@ -524,8 +520,6 @@
                 self._scale_xhi = newhi
                 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':
@@ -534,5 +528,4 @@
                 if hi > 0:
                     newhi = math.log10(hi) - ydelta
-                #print "new lo %f and new hi %f"%(newlo,newhi)
             if  self.yscale == 'log':
                 self._scale_ylo = math.pow(10, newlo)
@@ -548,5 +541,4 @@
         """
         For fit Dialog initial display
-        
         """
         self.xmin = 0.0
@@ -563,11 +555,11 @@
         self.ErrBvalue = None
         self.Chivalue = None
-    
+
     def onWheel(self, event):
         """
         Process mouse wheel as zoom events
-        
+
         :param event: Wheel event
-        
+
         """
         ax = event.inaxes
@@ -578,13 +570,13 @@
             lo, hi = ax.get_xlim()
             lo, hi = _rescale(lo, hi, step,
-                             pt=event.xdata, scale=ax.get_xscale())
+                              pt=event.xdata, scale=ax.get_xscale())
             if not self.xscale == 'log' or lo > 0:
                 self._scale_xlo = lo
                 self._scale_xhi = hi
-                ax.set_xlim((lo,hi))
+                ax.set_xlim((lo, hi))
 
             lo, hi = ax.get_ylim()
             lo, hi = _rescale(lo, hi, step, pt=event.ydata,
-                             scale=ax.get_yscale())
+                              scale=ax.get_yscale())
             if not self.yscale == 'log' or lo > 0:
                 self._scale_ylo = lo
@@ -595,5 +587,5 @@
             xdata, ydata = None, None
             x, y = event.x, event.y
-           
+
             for ax in self.axes:
                 insidex, _ = ax.xaxis.contains(event)
@@ -625,17 +617,17 @@
         Return values and labels used by Fit Dialog
         """
-        return self.xLabel, self.yLabel, self.Avalue, self.Bvalue,\
+        return self.xLabel, self.yLabel, self.Avalue, self.Bvalue, \
                 self.ErrAvalue, self.ErrBvalue, self.Chivalue
-    
+
     def setTrans(self, xtrans, ytrans):
         """
-        
+
         :param xtrans: set x transformation on Property dialog
         :param ytrans: set y transformation on Property dialog
-        
+
         """
         self.prevXtrans = xtrans
         self.prevYtrans = ytrans
-   
+
     def onFitting(self, event):
         """
@@ -654,5 +646,5 @@
             list = plotlist
         from fitDialog import LinearFit
-        
+
         if len(list.keys()) > 0:
             first_item = list.keys()[0]
@@ -661,5 +653,5 @@
                             transform=self.returnTrans,
                             title='Linear Fit')
-           
+
             if (self.xmin != 0.0)and (self.xmax != 0.0)\
                 and(self.xminView != 0.0)and (self.xmaxView != 0.0):
@@ -667,9 +659,9 @@
                                 self.xmin, self.xmax)
             dlg.ShowModal()
-            
+
     def set_selected_from_menu(self, menu, id):
         """
         Set selected_plottable from context menu selection
-        
+
         :param menu: context menu item
         :param id: menu item id
@@ -682,11 +674,11 @@
                 self.graph.selected_plottable = plot.id
                 break
-            
+
     def linear_plottable_fit(self, plot):
         """
             when clicking on linear Fit on context menu, display Fitting Dialog
-            
+
             :param plot: PlotPanel owning the graph
-            
+
         """
         from fitDialog import LinearFit
@@ -694,6 +686,6 @@
             return
         self._fit_dialog = LinearFit(None, plot, self.onFitDisplay,
-                                      self.returnTrans, -1, 'Linear Fit')
-        # Set the zoom area 
+                                     self.returnTrans, -1, 'Linear Fit')
+        # Set the zoom area
         if self._scale_xhi is not None and self._scale_xlo is not None:
             self._fit_dialog.set_fit_region(self._scale_xlo, self._scale_xhi)
@@ -708,5 +700,5 @@
         """
         self._fit_dialog = None
-        
+
     def _onProperties(self, event):
         """
@@ -719,8 +711,7 @@
             self._fit_dialog.Destroy()
             self._fit_dialog = None
-        list = []
-        list = self.graph.returnPlottable()
-        if len(list.keys()) > 0:
-            first_item = list.keys()[0]
+        plot_list = self.graph.returnPlottable()
+        if len(plot_list.keys()) > 0:
+            first_item = plot_list.keys()[0]
             if first_item.x != []:
                 from PropertyDialog import Properties
@@ -751,38 +742,38 @@
                     self._onEVT_FUNC_PROPERTY()
                 dial.Destroy()
-           
+
     def set_yscale(self, scale='linear'):
         """
         Set the scale on Y-axis
-        
+
         :param scale: the scale of y-axis
-        
+
         """
         self.subplot.set_yscale(scale, nonposy='clip')
         self.yscale = scale
-        
+
     def get_yscale(self):
         """
-        
+
         :return: Y-axis scale
-        
+
         """
         return self.yscale
-    
+
     def set_xscale(self, scale='linear'):
         """
         Set the scale on x-axis
-        
+
         :param scale: the scale of x-axis
-        
+
         """
         self.subplot.set_xscale(scale)
         self.xscale = scale
-       
+
     def get_xscale(self):
         """
-        
+
         :return: x-axis scale
-        
+
         """
         return self.xscale
@@ -791,9 +782,9 @@
         """
         Set figure and canvas colours to be the same
-        
+
         """
         if not rgbtuple:
             rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get()
-        col = [c/255.0 for c in rgbtuple]
+        col = [c / 255.0 for c in rgbtuple]
         self.figure.set_facecolor(col)
         self.figure.set_edgecolor(self.color)
@@ -817,5 +808,5 @@
         This method can be called to force the Plot to be a desired size,
          which defaults to the ClientSize of the panel
-         
+
         """
         if not pixels:
@@ -828,8 +819,8 @@
         """
         Where the actual drawing happens
-        
+
         """
         self.figure.canvas.draw_idle()
-        
+
     def legend_picker(self, legend, event):
         """
@@ -837,5 +828,5 @@
         """
         return self.legend.legendPatch.contains(event)
-        
+
     def get_loc_label(self):
         """
@@ -866,5 +857,5 @@
         _labels['center'] = i
         return _labels
-        
+
     def onSaveImage(self, evt):
         """
@@ -872,9 +863,9 @@
         """
         self.toolbar.save(evt)
-       
+
     def onContextMenu(self, event):
         """
         Default context menu for a plot panel
-        
+
         """
         # Slicer plot popup menu
@@ -883,17 +874,17 @@
         slicerpop.Append(id, '&Save image', 'Save image as PNG')
         wx.EVT_MENU(self, id, self.onSaveImage)
-        
+
         id = wx.NewId()
         slicerpop.Append(id, '&Printer setup', 'Set image size')
         wx.EVT_MENU(self, id, self.onPrinterSetup)
-        
+
         id = wx.NewId()
         slicerpop.Append(id, '&Printer Preview', 'Set image size')
         wx.EVT_MENU(self, id, self.onPrinterPreview)
-    
+
         id = wx.NewId()
         slicerpop.Append(id, '&Print image', 'Print image ')
         wx.EVT_MENU(self, id, self.onPrint)
-        
+
         id = wx.NewId()
         slicerpop.Append(id, '&Copy', 'Copy to the clipboard')
@@ -903,20 +894,20 @@
         #slicerpop.Append(id, '&Load 1D data file')
         #wx.EVT_MENU(self, id, self._onLoad1DData)
-       
+
         id = wx.NewId()
         slicerpop.AppendSeparator()
         slicerpop.Append(id, '&Properties')
         wx.EVT_MENU(self, id, self._onProperties)
-        
+
         id = wx.NewId()
         slicerpop.AppendSeparator()
         slicerpop.Append(id, '&Linear Fit')
         wx.EVT_MENU(self, id, self.onFitting)
-        
+
         id = wx.NewId()
         slicerpop.AppendSeparator()
         slicerpop.Append(id, '&Toggle Legend On/Off', 'Toggle Legend On/Off')
         wx.EVT_MENU(self, id, self.onLegend)
-        
+
         loc_menu = wx.Menu()
         for label in self._loc_labels:
@@ -926,5 +917,5 @@
         id = wx.NewId()
         slicerpop.AppendMenu(id, '&Modify Legend Location', loc_menu)
-        
+
         id = wx.NewId()
         slicerpop.Append(id, '&Modify Y Axis Label')
@@ -933,5 +924,5 @@
         slicerpop.Append(id, '&Modify X Axis Label')
         wx.EVT_MENU(self, id, self._on_xaxis_label)
-        
+
         try:
             # mouse event
@@ -942,11 +933,11 @@
             pos_x, pos_y = self.toolbar.GetPositionTuple()
             pos = (pos_x, pos_y + 5)
-            
+
         self.PopupMenu(slicerpop, pos)
-        
+
     def onToolContextMenu(self, event):
         """
         ContextMenu from toolbar
-        
+
         :param event: toolbar event
         """
@@ -955,9 +946,9 @@
         if self.graph.selected_plottable != None:
             self.graph.selected_plottable = None
-        
+
         self.onContextMenu(event)
-        
+
 # modified kieranrcampbell ILL june2012
-    def onLegend(self,legOnOff):
+    def onLegend(self, legOnOff):
         """
         Toggles whether legend is visible/not visible
@@ -975,11 +966,11 @@
             self.line_collections_list = handles2
             self.legend = self.subplot.legend(handles2, labels2,
-                            prop=FontProperties(size=10),
-                            loc=self.legendLoc)
+                                              prop=FontProperties(size=10),
+                                              loc=self.legendLoc)
             if self.legend != None:
                 self.legend.set_picker(self.legend_picker)
                 self.legend.set_axes(self.subplot)
                 self.legend.set_zorder(20)
-        
+
         self.subplot.figure.canvas.draw_idle()
 
@@ -989,6 +980,5 @@
         """
         menu = event.GetEventObject()
-        id = event.GetId()
-        label = menu.GetLabel(id)
+        label = menu.GetLabel(event.GetId())
         self.ChangeLegendLoc(label)
 
@@ -1006,6 +996,6 @@
         self.line_collections_list = handles2
         self.legend = self.subplot.legend(handles2, labels2,
-                            prop=FontProperties(size=10),
-                            loc=self.legendLoc)
+                                          prop=FontProperties(size=10),
+                                          loc=self.legendLoc)
         if self.legend != None:
             self.legend.set_picker(self.legend_picker)
@@ -1022,5 +1012,5 @@
             ax = gca()
         ax.legend_ = None
-        
+
     def _on_addtext(self, event):
         """
@@ -1049,13 +1039,12 @@
                 if len(label) > 0 and xpos > 0 and ypos > 0:
                     new_text = self.subplot.text(str(xpos), str(ypos), label,
-                                                   fontproperties=font,
-                                                   color=colour)
+                                                 fontproperties=font,
+                                                 color=colour)
                     self.textList.append(new_text)
                     self.subplot.figure.canvas.draw_idle()
             except:
                 if self.parent != None:
-                    from sas.guiframe.events import StatusEvent 
                     msg = "Add Text: Error. Check your property values..."
-                    wx.PostEvent(self.parent, StatusEvent(status = msg ))
+                    wx.PostEvent(self.parent, StatusEvent(status=msg))
                 else:
                     raise
@@ -1065,5 +1054,5 @@
         #based on this and plot it at user designated coordinates
 
-    def onGridOnOff(self,gridon_off):
+    def onGridOnOff(self, gridon_off):
         """
         Allows ON/OFF Grid
@@ -1072,14 +1061,14 @@
 
         self.subplot.figure.canvas.draw_idle()
-        
+
     def _on_xaxis_label(self, event):
         """
         Allows you to add text to the plot
         """
-        xaxis_label, xaxis_unit, xaxis_font, xaxis_color,\
+        xaxis_label, xaxis_unit, xaxis_font, xaxis_color, \
                      is_ok, is_tick = self._on_axis_label(axis='x')
         if not is_ok:
             return
-        
+
         self.xaxis_label = xaxis_label
         self.xaxis_unit = xaxis_unit
@@ -1088,8 +1077,8 @@
         if is_tick:
             self.xaxis_tick = xaxis_font
-        
+
         if self.data != None:
             # 2D
-            self.xaxis(self.xaxis_label, self.xaxis_unit,\
+            self.xaxis(self.xaxis_label, self.xaxis_unit, \
                         self.xaxis_font, self.xaxis_color, self.xaxis_tick)
             self.subplot.figure.canvas.draw_idle()
@@ -1097,5 +1086,5 @@
             # 1D
             self._check_zoom_plot()
-    
+
     def _check_zoom_plot(self):
         """
@@ -1119,10 +1108,10 @@
     def is_zoomed(self, value):
         self._is_zoomed = value
-                   
+
     def _on_yaxis_label(self, event):
         """
         Allows you to add text to the plot
         """
-        yaxis_label, yaxis_unit, yaxis_font, yaxis_color,\
+        yaxis_label, yaxis_unit, yaxis_font, yaxis_color, \
                         is_ok, is_tick = self._on_axis_label(axis='y')
         if not is_ok:
@@ -1138,5 +1127,5 @@
         if self.data != None:
             # 2D
-            self.yaxis(self.yaxis_label, self.yaxis_unit,\
+            self.yaxis(self.yaxis_label, self.yaxis_unit, \
                         self.yaxis_font, self.yaxis_color, self.yaxis_tick)
             self.subplot.figure.canvas.draw_idle()
@@ -1144,9 +1133,9 @@
             # 1D
             self._check_zoom_plot()
-            
+
     def _on_axis_label(self, axis='x'):
         """
         Modify axes labels
-        
+
         :param axis: x or y axis [string]
         """
@@ -1176,5 +1165,4 @@
                 if label_temp.count("\%s" % "\\") > 0:
                     if self.parent != None:
-                        from sas.guiframe.events import StatusEvent 
                         msg = "Add Label: Error. Can not use double '\\' "
                         msg += "characters..."
@@ -1184,5 +1172,4 @@
             except:
                 if self.parent != None:
-                    from sas.guiframe.events import StatusEvent
                     msg = "Add Label: Error. Check your property values..."
                     wx.PostEvent(self.parent, StatusEvent(status=msg))
@@ -1194,5 +1181,5 @@
         textdial.Destroy()
         return label, unit, font, colour, is_ok, is_tick
-        
+
     def _on_removetext(self, event):
         """
@@ -1203,27 +1190,24 @@
         if num_text < 1:
             if self.parent != None:
-                from sas.guiframe.events import StatusEvent
-                msg= "Remove Text: Nothing to remove.  "
+                msg = "Remove Text: Nothing to remove.  "
                 wx.PostEvent(self.parent, StatusEvent(status=msg))
             else:
                 raise
             return
-        txt = self.textList[num_text-1]
+        txt = self.textList[num_text - 1]
         try:
             text_remove = txt.get_text()
             txt.remove()
             if self.parent != None:
-                from sas.guiframe.events import StatusEvent
-                msg= "Removed Text: '%s'. " % text_remove
+                msg = "Removed Text: '%s'. " % text_remove
                 wx.PostEvent(self.parent, StatusEvent(status=msg))
         except:
             if self.parent != None:
-                from sas.guiframe.events import StatusEvent
-                msg= "Remove Text: Error occurred. "
+                msg = "Remove Text: Error occurred. "
                 wx.PostEvent(self.parent, StatusEvent(status=msg))
             else:
                 raise
         self.textList.remove(txt)
-            
+
         self.subplot.figure.canvas.draw_idle()
 
@@ -1232,5 +1216,5 @@
         Set some properties of the graph.
         The set of properties is not yet determined.
-        
+
         """
         # The particulars of how they are stored and manipulated (e.g., do
@@ -1252,5 +1236,5 @@
         self.subplot.clear()
         self.subplot.hold(True)
-    
+
     def render(self):
         """Commit the plot after all objects are drawn"""
@@ -1267,24 +1251,24 @@
                 self.line_collections_list = handles2
                 self.legend = ax.legend(handles2, labels2,
-                                prop=FontProperties(size=10),
-                                loc=self.legendLoc)
+                                        prop=FontProperties(size=10),
+                                        loc=self.legendLoc)
                 if self.legend != None:
                     self.legend.set_picker(self.legend_picker)
                     self.legend.set_axes(self.subplot)
                     self.legend.set_zorder(20)
-                
+
             except:
                 self.legend = ax.legend(prop=FontProperties(size=10),
                                         loc=self.legendLoc)
-                
+
     def xaxis(self, label, units, font=None, color='black', t_font=None):
         """xaxis label and units.
-        
+
         Axis labels know about units.
-        
+
         We need to do this so that we can detect when axes are not
         commesurate.  Currently this is ignored other than for formatting
         purposes.
-        
+
         """
 
@@ -1307,5 +1291,5 @@
             self.subplot.set_xlabel(label, color=color)
         pass
-    
+
     def yaxis(self, label, units, font=None, color='black', t_font=None):
         """yaxis label and units."""
@@ -1337,5 +1321,5 @@
 
     def interactive_points(self, x, y, dx=None, dy=None, name='', color=0,
-                           symbol=0, markersize=5, zorder=1, id=None, 
+                           symbol=0, markersize=5, zorder=1, id=None,
                            label=None, hide_error=False):
         """Draw markers with error bars"""
@@ -1348,10 +1332,10 @@
         if p.markersize != None:
             markersize = p.markersize
-        p.points(x, y, dx=dx, dy=dy, color=color, symbol=symbol, zorder=zorder, 
+        p.points(x, y, dx=dx, dy=dy, color=color, symbol=symbol, zorder=zorder,
                  markersize=markersize, label=label, hide_error=hide_error)
-        
+
         self.subplot.set_yscale(self.yscale, nonposy='clip')
         self.subplot.set_xscale(self.xscale)
-       
+
     def interactive_curve(self, x, y, dy=None, name='', color=0,
                           symbol=0, zorder=1, id=None, label=None):
@@ -1364,9 +1348,9 @@
         p = PointInteractor(self, self.subplot, zorder=zorder, id=id)
         p.curve(x, y, dy=dy, color=color, symbol=symbol, zorder=zorder,
-                 label=label)
-        
+                label=label)
+
         self.subplot.set_yscale(self.yscale, nonposy='clip')
         self.subplot.set_xscale(self.xscale)
-        
+
     def plottable_selected(self, id):
         """
@@ -1380,40 +1364,41 @@
                id=None, hide_error=False):
         """Draw markers with error bars"""
-        
+
         # Convert tuple (lo,hi) to array [(x-lo),(hi-x)]
         if dx != None and type(dx) == type(()):
-            dx = nx.vstack((x-dx[0], dx[1]-x)).transpose()
+            dx = nx.vstack((x - dx[0], dx[1] - x)).transpose()
         if dy != None and type(dy) == type(()):
-            dy = nx.vstack((y-dy[0], dy[1]-y)).transpose()
+            dy = nx.vstack((y - dy[0], dy[1] - y)).transpose()
         if dx == None and dy == None:
-            h = self.subplot.plot(x, y, color=self._color(color),
-                                   marker=self._symbol(symbol), markersize=marker_size,
-                                   linestyle='',
-                                   label=label)
+            self.subplot.plot(x, y, color=self._color(color),
+                              marker=self._symbol(symbol),
+                              markersize=marker_size,
+                              linestyle='',
+                              label=label)
         else:
             col = self._color(color)
             if hide_error:
-                h = self.subplot.plot(x, y, color=col,
-                                   marker=self._symbol(symbol),
-                                   markersize=marker_size,
-                                   linestyle='',
-                                   label=label)
-            else:
-                h = self.subplot.errorbar(x, y, yerr=dy, xerr=None,
-                                  ecolor=col, capsize=2, linestyle='',
-                                  barsabove=False,
-                                  mec=col, mfc=col,
+                self.subplot.plot(x, y, color=col,
                                   marker=self._symbol(symbol),
                                   markersize=marker_size,
-                                  lolims=False, uplims=False,
-                                  xlolims=False, xuplims=False, label=label)
-       
+                                  linestyle='',
+                                  label=label)
+            else:
+                self.subplot.errorbar(x, y, yerr=dy, xerr=None,
+                                      ecolor=col, capsize=2, linestyle='',
+                                      barsabove=False,
+                                      mec=col, mfc=col,
+                                      marker=self._symbol(symbol),
+                                      markersize=marker_size,
+                                      lolims=False, uplims=False,
+                                      xlolims=False, xuplims=False, label=label)
+
         self.subplot.set_yscale(self.yscale, nonposy='clip')
         self.subplot.set_xscale(self.xscale)
-        
+
     def _onToggleScale(self, event):
         """
         toggle axis and replot image
-        
+
         """
         zmin_2D_temp = self.zmin_2D
@@ -1435,5 +1420,5 @@
             if not self.zmax_2D is None:
                 zmax_2D_temp = math.log10(self.zmax_2D)
-                 
+
         self.image(data=self.data, qx_data=self.qx_data,
                    qy_data=self.qy_data, xmin=self.xmin_2D,
@@ -1442,5 +1427,5 @@
                    cmap=self.cmap, zmin=zmin_2D_temp,
                    zmax=zmax_2D_temp)
-      
+
     def image(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax,
               zmin, zmax, color=0, symbol=0, markersize=0,
@@ -1448,5 +1433,5 @@
         """
         Render the current data
-        
+
         """
         self.data = data
@@ -1472,14 +1457,14 @@
                 if  self.zmin_2D <= 0  and len(output[output > 0]) > 0:
                     zmin_temp = self.zmin_2D
-                    output[output>0] = numpy.log10(output[output>0])
+                    output[output > 0] = numpy.log10(output[output > 0])
                     #In log scale Negative values are not correct in general
                     #output[output<=0] = math.log(numpy.min(output[output>0]))
                 elif self.zmin_2D <= 0:
                     zmin_temp = self.zmin_2D
-                    output[output>0] = numpy.zeros(len(output))
-                    output[output<=0] = -32
-                else: 
+                    output[output > 0] = numpy.zeros(len(output))
+                    output[output <= 0] = -32
+                else:
                     zmin_temp = self.zmin_2D
-                    output[output>0] = numpy.log10(output[output>0])
+                    output[output > 0] = numpy.log10(output[output > 0])
                     #In log scale Negative values are not correct in general
                     #output[output<=0] = math.log(numpy.min(output[output>0]))
@@ -1487,5 +1472,5 @@
                 #Too many problems in 2D plot with scale
                 pass
-                      
+
         else:
             zmin_temp = self.zmin_2D
@@ -1494,5 +1479,5 @@
             #Re-adjust colorbar
             self.subplot.figure.subplots_adjust(left=0.2, right=.8, bottom=.2)
-            
+
             im = self.subplot.imshow(output, interpolation='nearest',
                                      origin='lower',
@@ -1500,7 +1485,7 @@
                                      cmap=self.cmap,
                                      extent=(self.xmin_2D, self.xmax_2D,
-                                                self.ymin_2D, self.ymax_2D))
-            
-            cbax = self.subplot.figure.add_axes([0.84,0.2,0.02,0.7])
+                                             self.ymin_2D, self.ymax_2D))
+
+            cbax = self.subplot.figure.add_axes([0.84, 0.2, 0.02, 0.7])
         else:
             # clear the previous 2D from memory
@@ -1513,10 +1498,10 @@
             Y = self.y_bins[0:-1]
             X, Y = numpy.meshgrid(X, Y)
-            
+
             try:
                 # mpl >= 1.0.0
                 ax = self.subplot.figure.gca(projection='3d')
                 #ax.disable_mouse_rotation()
-                cbax = self.subplot.figure.add_axes([0.84,0.1,0.02,0.8])
+                cbax = self.subplot.figure.add_axes([0.84, 0.1, 0.02, 0.8])
                 if len(X) > 60:
                     ax.disable_mouse_rotation()
@@ -1534,7 +1519,7 @@
             self.subplot.figure.canvas.resizing = False
             im = ax.plot_surface(X, Y, output, rstride=1, cstride=1, cmap=cmap,
-                                   linewidth=0, antialiased=False)
+                                 linewidth=0, antialiased=False)
             self.subplot.set_axis_off()
-            
+
         if cbax == None:
             ax.set_frame_on(False)
@@ -1548,5 +1533,5 @@
         else:
             self.figure.canvas.draw()
-    
+
     def _build_matrix(self):
         """
@@ -1556,5 +1541,5 @@
         self.data, self.qx_data, and self.qy_data
         where each one corresponds to z, x, or y axis values
-        
+
         """
         # No qx or qy given in a vector format
@@ -1563,5 +1548,5 @@
             # do we need deepcopy here?
             return copy.deepcopy(self.data)
-     
+
         # maximum # of loops to fillup_pixels
         # otherwise, loop could never stop depending on data
@@ -1570,5 +1555,5 @@
         self._get_bins()
         # set zero to None
-        
+
         #Note: Can not use scipy.interpolate.Rbf:
         # 'cause too many data points (>10000)<=JHC.
@@ -1580,15 +1565,15 @@
         weights, xedges, yedges = numpy.histogram2d(x=self.qy_data,
                                                     y=self.qx_data,
-                                            bins=[self.y_bins, self.x_bins],
-                                            weights=weights_data)
+                                                    bins=[self.y_bins, self.x_bins],
+                                                    weights=weights_data)
         # get histogram of data, all points into a bin in a way of summing
         image, xedges, yedges = numpy.histogram2d(x=self.qy_data,
                                                   y=self.qx_data,
-                                            bins=[self.y_bins, self.x_bins],
-                                            weights=self.data)
+                                                  bins=[self.y_bins, self.x_bins],
+                                                  weights=self.data)
         # Now, normalize the image by weights only for weights>1: 
         # If weight == 1, there is only one data point in the bin so
         # that no normalization is required.
-        image[weights > 1] = image[weights>1]/weights[weights>1]
+        image[weights > 1] = image[weights > 1] / weights[weights > 1]
         # Set image bins w/o a data point (weight==0) as None (was set to zero
         # by histogram2d.)
@@ -1598,15 +1583,15 @@
         #one None point exists
         loop = 0
-        
+
         # do while loop until all vacant bins are filled up up
         #to loop = max_loop
-        while(not(numpy.isfinite(image[weights == 0])).all()):
+        while not(numpy.isfinite(image[weights == 0])).all():
             if loop >= max_loop:  # this protects never-ending loop
                 break
             image = self._fillup_pixels(image=image, weights=weights)
             loop += 1
-               
+
         return image
-    
+
     def _get_bins(self):
         """
@@ -1623,5 +1608,5 @@
             # do we need deepcopy here?
             return copy.deepcopy(self.data)
-        
+
         # find max and min values of qx and qy
         xmax = self.qx_data.max()
@@ -1629,10 +1614,10 @@
         ymax = self.qy_data.max()
         ymin = self.qy_data.min()
-        
+
         # calculate the range of qx and qy: this way, it is a little
         # more independent
         x_size = xmax - xmin
         y_size = ymax - ymin
-        
+
         # estimate the # of pixels on each axes
         npix_y = int(math.floor(math.sqrt(len(self.qy_data))))
@@ -1648,11 +1633,9 @@
         ymax = ymax + ystep / 2.0
         ymin = ymin - ystep / 2.0
-        
+
         # store x and y bin centers in q space
         x_bins = numpy.linspace(xmin, xmax, npix_x)
         y_bins = numpy.linspace(ymin, ymax, npix_y)
-        #x_bins = numpy.arange(xmin, xmax + xstep / 10.0, xstep)
-        #y_bins = numpy.arange(ymin, ymax + ystep / 10.0, ystep)
-      
+
         #set x_bins and y_bins
         self.x_bins = x_bins
@@ -1663,11 +1646,11 @@
         Fill z values of the empty cells of 2d image matrix
         with the average over up-to next nearest neighbor points
-        
+
         :param image: (2d matrix with some zi = None)
-        
+
         :return: image (2d array )
-        
+
         :TODO: Find better way to do for-loop below
-        
+
         """
         # No image matrix given
@@ -1690,33 +1673,33 @@
                     # find 4 nearest neighbors
                     # check where or not it is at the corner
-                    if n_y != 0 and numpy.isfinite(image[n_y-1][n_x]):
-                        temp_image[n_y][n_x] += image[n_y-1][n_x]
+                    if n_y != 0 and numpy.isfinite(image[n_y - 1][n_x]):
+                        temp_image[n_y][n_x] += image[n_y - 1][n_x]
                         weit[n_y][n_x] += 1
-                    if n_x != 0 and numpy.isfinite(image[n_y][n_x-1]):
-                        temp_image[n_y][n_x] += image[n_y][n_x-1]
+                    if n_x != 0 and numpy.isfinite(image[n_y][n_x - 1]):
+                        temp_image[n_y][n_x] += image[n_y][n_x - 1]
                         weit[n_y][n_x] += 1
-                    if n_y != len_y -1 and numpy.isfinite(image[n_y+1][n_x]):
-                        temp_image[n_y][n_x] += image[n_y+1][n_x]  
+                    if n_y != len_y - 1 and numpy.isfinite(image[n_y + 1][n_x]):
+                        temp_image[n_y][n_x] += image[n_y + 1][n_x]
                         weit[n_y][n_x] += 1
-                    if n_x != len_x -1 and numpy.isfinite(image[n_y][n_x+1]):
-                        temp_image[n_y][n_x] += image[n_y][n_x+1]
+                    if n_x != len_x - 1 and numpy.isfinite(image[n_y][n_x + 1]):
+                        temp_image[n_y][n_x] += image[n_y][n_x + 1]
                         weit[n_y][n_x] += 1
                     # go 4 next nearest neighbors when no non-zero
                     # neighbor exists
                     if n_y != 0 and n_x != 0 and\
-                         numpy.isfinite(image[n_y-1][n_x-1]):
-                        temp_image[n_y][n_x] += image[n_y-1][n_x-1]
+                         numpy.isfinite(image[n_y - 1][n_x - 1]):
+                        temp_image[n_y][n_x] += image[n_y - 1][n_x - 1]
                         weit[n_y][n_x] += 1
-                    if n_y != len_y -1 and n_x != 0 and \
-                        numpy.isfinite(image[n_y+1][n_x-1]):
-                        temp_image[n_y][n_x] += image[n_y+1][n_x-1]
+                    if n_y != len_y - 1 and n_x != 0 and \
+                        numpy.isfinite(image[n_y + 1][n_x - 1]):
+                        temp_image[n_y][n_x] += image[n_y + 1][n_x - 1]
                         weit[n_y][n_x] += 1
-                    if n_y != len_y and n_x != len_x -1 and \
-                        numpy.isfinite(image[n_y-1][n_x+1]):
-                        temp_image[n_y][n_x] += image[n_y-1][n_x+1]  
+                    if n_y != len_y and n_x != len_x - 1 and \
+                        numpy.isfinite(image[n_y - 1][n_x + 1]):
+                        temp_image[n_y][n_x] += image[n_y - 1][n_x + 1]
                         weit[n_y][n_x] += 1
-                    if n_y != len_y -1 and n_x != len_x -1 and \
-                        numpy.isfinite(image[n_y+1][n_x+1]):
-                        temp_image[n_y][n_x] += image[n_y+1][n_x+1]
+                    if n_y != len_y - 1 and n_x != len_x - 1 and \
+                        numpy.isfinite(image[n_y + 1][n_x + 1]):
+                        temp_image[n_y][n_x] += image[n_y + 1][n_x + 1]
                         weit[n_y][n_x] += 1
 
@@ -1724,7 +1707,7 @@
         ind = (weit > 0)
         image[ind] = temp_image[ind] / weit[ind]
-        
+
         return image
-         
+
     def curve(self, x, y, dy=None, color=0, symbol=0, label=None):
         """Draw a line on a graph, possibly with confidence intervals."""
@@ -1732,5 +1715,5 @@
         self.subplot.set_yscale('linear')
         self.subplot.set_xscale('linear')
-        
+
         self.subplot.plot(x, y, color=c, marker='',
                           linestyle='-', label=label)
@@ -1745,12 +1728,12 @@
         """Return a particular symbol"""
         return self.symbollist[s % len(self.symbollist)]
-   
+
     def _replot(self, remove_fit=False):
         """
         Rescale the plottables according to the latest
         user selection and update the plot
-        
+
         :param remove_fit: Fit line will be removed if True
-        
+
         """
         self.graph.reset_scale()
@@ -1760,5 +1743,5 @@
         self.graph.render(self)
         self.subplot.figure.canvas.draw_idle()
-   
+
     def _onEVT_FUNC_PROPERTY(self, remove_fit=True, show=True):
         """
@@ -1771,7 +1754,6 @@
         if remove_fit:
             self.graph.delete(self.fit_result)
-        self.ly = None 
-        self.q_ctrl = None   
-        list = []
+        self.ly = None
+        self.q_ctrl = None
         list = self.graph.returnPlottable()
         # Changing the scale might be incompatible with
@@ -1786,5 +1768,5 @@
         for item in list:
             item.setLabel(self.xLabel, self.yLabel)
-            
+
             # control axis labels from the panel itself
             yname, yunits = item.get_yaxis()
@@ -1803,51 +1785,51 @@
                 self.xaxis_unit = xunits
             # Goes through all possible scales
-            if(self.xLabel == "x"):
+            if self.xLabel == "x":
                 item.transformX(transform.toX, transform.errToX)
                 self.graph._xaxis_transformed("%s" % xname, "%s" % xunits)
-            if(self.xLabel == "x^(2)"):
+            if self.xLabel == "x^(2)":
                 item.transformX(transform.toX2, transform.errToX2)
                 xunits = convertUnit(2, xunits)
                 self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits)
-            if(self.xLabel == "x^(4)"):
+            if self.xLabel == "x^(4)":
                 item.transformX(transform.toX4, transform.errToX4)
                 xunits = convertUnit(4, xunits)
                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)
-            if(self.xLabel == "ln(x)"):
+            if self.xLabel == "ln(x)":
                 item.transformX(transform.toLogX, transform.errToLogX)
                 self.graph._xaxis_transformed("\ln\\ %s" % xname, "%s" % xunits)
-            if(self.xLabel == "log10(x)"):
+            if self.xLabel == "log10(x)":
                 item.transformX(transform.toX_pos, transform.errToX_pos)
                 _xscale = 'log'
                 self.graph._xaxis_transformed("%s" % xname, "%s" % xunits)
-            if(self.xLabel == "log10(x^(4))"):
+            if self.xLabel == "log10(x^(4))":
                 item.transformX(transform.toX4, transform.errToX4)
                 xunits = convertUnit(4, xunits)
                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits)
                 _xscale = 'log'
-            if(self.yLabel == "ln(y)"):
+            if self.yLabel == "ln(y)":
                 item.transformY(transform.toLogX, transform.errToLogX)
                 self.graph._yaxis_transformed("\ln\\ %s" % yname, "%s" % yunits)
-            if(self.yLabel == "y"):
+            if self.yLabel == "y":
                 item.transformY(transform.toX, transform.errToX)
                 self.graph._yaxis_transformed("%s" % yname, "%s" % yunits)
-            if(self.yLabel == "log10(y)"):
+            if self.yLabel == "log10(y)":
                 item.transformY(transform.toX_pos, transform.errToX_pos)
                 _yscale = 'log'
                 self.graph._yaxis_transformed("%s" % yname, "%s" % yunits)
-            if(self.yLabel == "y^(2)"):
+            if self.yLabel == "y^(2)":
                 item.transformY(transform.toX2, transform.errToX2)
                 yunits = convertUnit(2, yunits)
                 self.graph._yaxis_transformed("%s^{2}" % yname, "%s" % yunits)
-            if(self.yLabel == "1/y"):
+            if self.yLabel == "1/y":
                 item.transformY(transform.toOneOverX, transform.errOneOverX)
                 yunits = convertUnit(-1, yunits)
                 self.graph._yaxis_transformed("1/%s" % yname, "%s" % yunits)
-            if(self.yLabel == "y*x^(4)"):
+            if self.yLabel == "y*x^(4)":
                 item.transformY(transform.toYX4, transform.errToYX4)
                 xunits = convertUnit(4, self.xaxis_unit)
                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
-                                               "%s%s" % (yunits, xunits))
-            if(self.yLabel == "1/sqrt(y)"):
+                                              "%s%s" % (yunits, xunits))
+            if self.yLabel == "1/sqrt(y)":
                 item.transformY(transform.toOneOverSqrtX,
                                 transform.errOneOverSqrtX)
@@ -1855,31 +1837,31 @@
                 self.graph._yaxis_transformed("1/\sqrt{%s}" % yname,
                                               "%s" % yunits)
-            if(self.yLabel == "ln(y*x)"):
+            if self.yLabel == "ln(y*x)":
                 item.transformY(transform.toLogXY, transform.errToLogXY)
                 self.graph._yaxis_transformed("\ln (%s \ \ %s)" % (yname, xname),
-                                            "%s%s" % (yunits, self.xaxis_unit))
-            if(self.yLabel == "ln(y*x^(2))"):
-                item.transformY( transform.toLogYX2, transform.errToLogYX2) 
+                                              "%s%s" % (yunits, self.xaxis_unit))
+            if self.yLabel == "ln(y*x^(2))":
+                item.transformY(transform.toLogYX2, transform.errToLogYX2)
                 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))"):
+                                              "%s%s" % (yunits, xunits))
+            if self.yLabel == "ln(y*x^(4))":
                 item.transformY(transform.toLogYX4, transform.errToLogYX4)
                 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))"):
+                                              "%s%s" % (yunits, xunits))
+            if self.yLabel == "log10(y*x^(4))":
                 item.transformY(transform.toYX4, transform.errToYX4)
                 xunits = convertUnit(4, self.xaxis_unit)
                 _yscale = 'log'
                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
-                                               "%s%s" % (yunits, xunits))
-            if(self.viewModel == "Guinier lny vs x^(2)"):
+                                              "%s%s" % (yunits, xunits))
+            if self.viewModel == "Guinier lny vs x^(2)":
                 item.transformX(transform.toX2, transform.errToX2)
                 xunits = convertUnit(2, xunits)
                 self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits)
-                item.transformY(transform.toLogX,transform.errToLogX)
+                item.transformY(transform.toLogX, transform.errToLogX)
                 self.graph._yaxis_transformed("\ln\ \ %s" % yname, "%s" % yunits)
-            if(self.viewModel == "Porod y*x^(4) vs x^(4)"):
+            if self.viewModel == "Porod y*x^(4) vs x^(4)":
                 item.transformX(transform.toX4, transform.errToX4)
                 xunits = convertUnit(4, self.xaxis_unit)
@@ -1887,7 +1869,7 @@
                 item.transformY(transform.toYX4, transform.errToYX4)
                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname),
-                                               "%s%s" % (yunits, xunits))
+                                              "%s%s" % (yunits, xunits))
             item.transformView()
-  
+
         # set new label and units
         yname = self.graph.prop["ylabel"]
@@ -1895,5 +1877,5 @@
         xname = self.graph.prop["xlabel"]
         xunits = ''
-                
+
         self.resetFitView()
         self.prevXtrans = self.xLabel
@@ -1902,5 +1884,5 @@
         self.set_xscale(_xscale)
         self.set_yscale(_yscale)
-        
+
         self.xaxis(xname, xunits, self.xaxis_font,
                    self.xaxis_color, self.xaxis_tick)
@@ -1910,5 +1892,5 @@
         if show:
             self.subplot.figure.canvas.draw_idle()
-        
+
     def onFitDisplay(self, tempx, tempy, xminView,
                      xmaxView, xmin, xmax, func):
@@ -1916,5 +1898,5 @@
         Add a new plottable into the graph .In this case this plottable
         will be used to fit some data
-        
+
         :param tempx: The x data of fit line
         :param tempy: The y data of fit line
@@ -1923,5 +1905,5 @@
         :param xmin: the lowest value of data to fit to the line
         :param xmax: the highest value of data to fit to the line
-        
+
         """
         # Saving value to redisplay in Fit Dialog when it is opened again
@@ -1964,16 +1946,16 @@
         if dial.ShowModal() == wx.ID_OK:
             new_caption = dial.getText()
-          
+
             # send to guiframe to change the panel caption
             caption = self.parent.on_change_caption(self.window_name,
                                                     old_caption, new_caption)
-            
+
             # also set new caption in plot_panels list
             self.parent.plot_panels[self.uid].window_caption = caption
             # set new caption
             self.window_caption = caption
-            
+
         dial.Destroy()
-         
+
     def onResetGraph(self, event):
         """
@@ -1988,5 +1970,5 @@
         self.is_zoomed = False
         self.toolbar.update()
-        
+
     def onPrinterSetup(self, event=None):
         """
@@ -2003,5 +1985,5 @@
         except:
             pass
-        
+
     def onPrint(self, event=None):
         """
@@ -2012,5 +1994,5 @@
         except:
             pass
-     
+
     def OnCopyFigureMenu(self, evt):
         """
@@ -2022,5 +2004,5 @@
             print "Error in copy Image"
 
- 
+
 #---------------------------------------------------------------
 class NoRepaintCanvas(FigureCanvasWxAgg):
@@ -2029,5 +2011,5 @@
     the draw method is only called for the first two paint events. After that,
     the canvas will only be redrawn when it is resized.
-    
+
     """
     def __init__(self, *args, **kwargs):
@@ -2040,5 +2022,5 @@
         """
         Called when wxPaintEvt is generated
-        
+
         """
         if not self._isRealized:
