Index: guitools/PlotPanel.py
===================================================================
--- guitools/PlotPanel.py	(revision 34ae30236bd5c694f1d13da4a01dc8c70f84415e)
+++ guitools/PlotPanel.py	(revision bbec827a62dd9a38aa3499ec4e2d1c2309d427ba)
@@ -12,5 +12,6 @@
 from matplotlib.widgets import RectangleSelector
 from pylab import  gca, gcf
-
+from plottables import Theory1D
+#from plottables import Data1D
 #TODO: make the plottables interactive
 
@@ -103,4 +104,9 @@
         self.canvas.mpl_connect('scroll_event',self.onWheel)
         self.axes = [self.subplot]
+         # new data for the fit 
+        self.fit_result = Theory1D(x=[], y=[], dy=None)
+        #self.fit_result = Data1D(x=[], y=[],dx=None, dy=None)
+        self.fit_result.name = "Fit"
+        self.fit_result.ID = "isFit"
 
     def onWheel(self, event):
@@ -130,9 +136,9 @@
                 if insidex:
                     xdata,_ = ax.transAxes.inverse_xy_tup((x,y))
-                    print "xaxis",x,"->",xdata
+                    #print "xaxis",x,"->",xdata
                 insidey,_ = ax.yaxis.contains(event)
                 if insidey:
                     _,ydata = ax.transAxes.inverse_xy_tup((x,y))
-                    print "yaxis",y,"->",ydata
+                    #print "yaxis",y,"->",ydata
             if xdata is not None:
                 lo,hi = ax.get_xlim()
@@ -420,4 +426,8 @@
         list =[]
         list = self.graph.returnPlottable()
+        self.fit_result.x =[]  
+        self.fit_result.y =[] 
+        self.fit_result.dx=None
+        self.fit_result.dy=None
         
         for item in list:
@@ -507,13 +517,12 @@
                 name, units = item.get_yaxis()
                 self.graph.yaxis("$Log %s$" % name,  "%s^{-1}" % units)
-                
+            item.transformView()
         #item.name = self.yscales+" vs " +self.xscales      
         self.prevXtrans = self.xscales 
         self.prevYtrans = self.yscales  
-        item.transformView()
         self.graph.render(self)
         self.subplot.figure.canvas.draw_idle()
         
-    def onFitDisplay(self, plottable,xmin,xmax):
+    def onFitDisplay(self, tempx,tempy,xmin,xmax):
         """
             Add a new plottable into the graph .In this case this plottable will be used 
@@ -521,14 +530,24 @@
             @param plottable: the plottable to plot
         """
+        
+        
         list =[]
         list = self.graph.returnPlottable()
         for item in list:
             item.onFitRange(xmin,xmax)
-        #Add the data to fit 
-        self.graph.add(plottable)
+        # Create new data plottable with result
+        self.fit_result.x =[] 
+        self.fit_result.y =[]
+        self.fit_result.x =tempx  
+        self.fit_result.y =tempy     
+        self.fit_result.dx=None
+        self.fit_result.dy=None
+        #Load the view with the new values
+        self.fit_result.reset_view() 
+        self.graph.add(self.fit_result) 
+        
         self.graph.render(self)
-        
         self.subplot.figure.canvas.draw_idle()
-        self.graph.delete(plottable)
+        #self.graph.delete(plottable)
    
     def onResetGraph(self,event):
Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 34ae30236bd5c694f1d13da4a01dc8c70f84415e)
+++ guitools/fitDialog.py	(revision bbec827a62dd9a38aa3499ec4e2d1c2309d427ba)
@@ -138,6 +138,7 @@
     
         # new data for the fit 
-        self.file_data1 = Theory1D(x=[], y=[], dy=None)
-        self.file_data1.name = "Fit"
+        #self.file_data1 = Theory1D(x=[], y=[], dy=None)
+        #self.file_data1.name = "Fit"
+        #self.file_data1.ID = "isFit"
         # Receive transformations of x and y
         self.xtrans,self.ytrans= self.transform()
@@ -252,15 +253,16 @@
               
                 # Create new data plottable with result
-                self.file_data1.x =[] 
-                self.file_data1.y =[] 
-                self.file_data1.x =tempx  
-                self.file_data1.y =tempy     
-                self.file_data1.dx=None
-                self.file_data1.dy=None
+                #self.file_data1.x =[] 
+                #self.file_data1.y =[] 
+                #self.file_data1.x =tempx  
+                #self.file_data1.y =tempy     
+                #self.file_data1.dx=None
+                #self.file_data1.dy=None
                 #Load the view with the new values
-                self.file_data1.reset_view()
+                #self.file_data1.reset_view()
                 
                 #Send the data to display to the PlotPanel
-                self.push_data(self.file_data1,xminView,xmaxView)
+                #self.push_data(self.file_data1,xminView,xmaxView)
+                self.push_data(tempx,tempy,xminView,xmaxView)
                 
                 # Display the fitting value on the Fit Dialog
Index: guitools/plottables.py
===================================================================
--- guitools/plottables.py	(revision 34ae30236bd5c694f1d13da4a01dc8c70f84415e)
+++ guitools/plottables.py	(revision bbec827a62dd9a38aa3499ec4e2d1c2309d427ba)
@@ -204,5 +204,6 @@
                      "title":""}
         self.plottables = {}
-
+    def setGraph(self,listofplottable):
+        self.plottables = listofplottable
     def _make_labels(self):
         # Find groups of related plottables
@@ -386,4 +387,5 @@
         self._yunit = "" 
         
+        
     def set_View(self,x,y):
         """ Load View  """
@@ -445,5 +447,5 @@
         dx = None
         dy = None
-        
+        ID = ""
         
         def __init__(self, x=None, y=None, dx=None, dy=None):
@@ -611,4 +613,8 @@
             tempy=[]
             tempdy=[]
+            if self.dx==None:
+                self.dx=numpy.zeros(len(self.x))
+            if self.dy==None:
+                self.dy=numpy.zeros(len(self.y))
             for i in range(len(self.x)):
                 if ( self.x[i] >= xmin ) and ( self.x[i] <= xmax ):
@@ -635,4 +641,5 @@
         """
         self.name = "data"
+        self.ID= ""
         self.x = x
         self.y = y
@@ -673,5 +680,7 @@
         self.y = y
         self.dy = dy
-       
+        self.ID= ""
+        self.xaxis( 'q', 'A')
+        self.yaxis( 'intensity', 'cm')
         self.view = self.View(self.x, self.y, None, self.dy)
     def render(self,plot,**kw):
