Index: guiframe/local_perspectives/plotting/plotting.py
===================================================================
--- guiframe/local_perspectives/plotting/plotting.py	(revision 96f13a9c9857cd4deba0bb5b87181ea59278d814)
+++ guiframe/local_perspectives/plotting/plotting.py	(revision fc2b91afc6076aae125fc1d951a13724406f7f90)
@@ -18,8 +18,11 @@
 class PanelMenu(wx.Menu):
     plots = None
+    graph = None
     
     def set_plots(self, plots):
         self.plots = plots
     
+    def set_graph(self, graph):
+        self.graph = graph
 
 class View1DPanel(PlotPanel):
@@ -71,5 +74,9 @@
         is_new = True
         if event.plot.name in self.plots.keys():
-            is_new = False
+            # Check whether the class of plottable changed
+            if not event.plot.__class__==self.plots[event.plot.name].__class__:
+                self.graph.delete(self.plots[event.plot.name])
+            else:
+                is_new = False
         
         if is_new:
@@ -103,7 +110,11 @@
         slicerpop = PanelMenu()
         slicerpop.set_plots(self.plots)
+        slicerpop.set_graph(self.graph)
                 
         # Option to save the data displayed
-        for plot in self.graph.plottables:
+        
+        #for plot in self.graph.plottables:
+        if self.graph.selected_plottable in self.plots:
+            plot = self.plots[self.graph.selected_plottable]
             id = wx.NewId()
             name = plot.name
@@ -117,15 +128,16 @@
         wx.EVT_MENU(self, id, self.onSaveImage)
         
-        slicerpop.AppendSeparator()
+        
         item_list = self.parent.get_context_menu(self.graph)
-        if not item_list==None:
-            for item in item_list:
-                try:
-                    id = wx.NewId()
-                    slicerpop.Append(id, item[0], item[1])
-                    wx.EVT_MENU(self, id, item[2])
-                except:
-                    print sys.exc_value
-                    print RuntimeError, "View1DPanel.onContextMenu: bad menu item"
+        if (not item_list==None) and (not len(item_list)==0):
+                slicerpop.AppendSeparator()
+                for item in item_list:
+                    try:
+                        id = wx.NewId()
+                        slicerpop.Append(id, item[0], item[1])
+                        wx.EVT_MENU(self, id, item[2])
+                    except:
+                        print sys.exc_value
+                        print RuntimeError, "View1DPanel.onContextMenu: bad menu item"
         
         slicerpop.AppendSeparator()
@@ -135,4 +147,10 @@
         #wx.EVT_MENU(self, id, self._onToggleScale)
 
+        if self.graph.selected_plottable in self.plots:
+            if self.plots[self.graph.selected_plottable].__class__.__name__=="Theory1D":
+                id = wx.NewId()
+                slicerpop.Append(id, '&Add errors to data')
+                wx.EVT_MENU(self, id, self._on_add_errors)
+
         id = wx.NewId()
         slicerpop.Append(id, '&Change scale')
@@ -140,5 +158,5 @@
         
         id = wx.NewId()
-        slicerpop.AppendSeparator()
+        #slicerpop.AppendSeparator()
         slicerpop.Append(id, '&Reset Graph')
         wx.EVT_MENU(self, id, self.onResetGraph)        
@@ -147,4 +165,37 @@
         pos = self.ScreenToClient(pos)
         self.PopupMenu(slicerpop, pos)
+    
+    def _on_add_errors(self, evt):
+        """
+            Compute reasonable errors for a data set without 
+            errors and transorm the plottable to a Data1D
+        """
+        import math
+        import numpy
+        from sans.guitools.plottables import Data1D
+        
+        if not self.graph.selected_plottable == None:
+            length = len(self.plots[self.graph.selected_plottable].x)
+            dy = numpy.zeros(length)
+            for i in range(length):
+                dy[i] = math.sqrt(self.plots[self.graph.selected_plottable].y[i])
+                
+            new_plot = Data1D(self.plots[self.graph.selected_plottable].x,
+                              self.plots[self.graph.selected_plottable].y,
+                              dy=dy)
+            new_plot.interactive = True
+            new_plot.name = self.plots[self.graph.selected_plottable].name
+            label, unit = self.plots[self.graph.selected_plottable].get_xaxis()
+            new_plot.xaxis(label, unit)
+            label, unit = self.plots[self.graph.selected_plottable].get_yaxis()
+            new_plot.yaxis(label, unit)
+            
+            self.graph.delete(self.plots[self.graph.selected_plottable])
+            
+            self.graph.add(new_plot)
+            self.plots[self.graph.selected_plottable]=new_plot
+            
+            self.graph.render(self)
+            self.subplot.figure.canvas.draw_idle()    
     
     def _onSave(self, evt):
