Index: guiframe/data_panel.py
===================================================================
--- guiframe/data_panel.py	(revision a03d419257aa974d705140242fbdf985d0e305a8)
+++ guiframe/data_panel.py	(revision e26d0db750e48c6007a701a55c50b1e267b72b86)
@@ -24,4 +24,5 @@
 from sans.guiframe.events import EVT_DELETE_PLOTPANEL
 from sans.guiframe.events import NewLoadDataEvent
+from sans.guiframe.events import NewPlotEvent
 from sans.guiframe.gui_style import GUIFRAME
 from DataLoader.loader import Loader
@@ -155,5 +156,5 @@
       
         self.sizer2 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer3 = wx.FlexGridSizer(6, 2, 0, 0)
+        self.sizer3 = wx.FlexGridSizer(7, 2, 0, 0)
         self.sizer4 = wx.BoxSizer(wx.HORIZONTAL)
         self.sizer5 = wx.BoxSizer(wx.VERTICAL)
@@ -270,4 +271,9 @@
         self.bt_freeze.SetToolTipString("To trigger freeze a theory")
         wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze)
+        #hide plot
+        self.bt_close_plot = wx.Button(self, wx.NewId(), "Close Plot", 
+                                   size=(BUTTON_WIDTH, -1))
+        self.bt_freeze.SetToolTipString("Close the plot panel on focus")
+        wx.EVT_BUTTON(self, self.bt_close_plot.GetId(), self.on_close_plot)
        
         self.cb_plotpanel = wx.ComboBox(self, -1, size=(CBOX_WIDTH, -1),
@@ -287,4 +293,6 @@
                               ((10, 10)),
                               (self.bt_freeze),
+                              ((10, 10)),
+                              (self.bt_close_plot),
                               ((10, 10))])
 
@@ -296,4 +304,5 @@
         self.enable_append()
         self.enable_freeze()
+        self.enable_remove_plot()
         
     def layout_batch(self):
@@ -613,6 +622,10 @@
                 item, _, _ = value
                 if item.IsChecked():
-                    self.tree_ctrl.Delete(item)
+                    try:
+                        self.tree_ctrl.Delete(item)
+                    except:
+                        pass
                     theory_key.append(key)
+                    
         #Remove data and related theory references
         for key in data_key:
@@ -624,5 +637,13 @@
             for t_key, theory_dict in self.list_cb_theory.iteritems():
                 if key in theory_dict:
+                    for  key, value in theory_dict.iteritems():
+                        item, _, _ = value
+                        if item.IsChecked():
+                            try:
+                                self.tree_ctrl_theory.Delete(item)
+                            except:
+                                pass
                     del theory_dict[key]
+                    
             
         self.parent.remove_data(data_id=data_to_remove,
@@ -630,4 +651,5 @@
         self.enable_remove()
         self.enable_freeze()
+        self.enable_remove_plot()
         
     def on_import(self, event=None):
@@ -659,4 +681,5 @@
                               theory_id=theory_id,
                               append=False)
+        self.enable_remove_plot()
          
     def on_close_page(self, event=None):
@@ -707,4 +730,5 @@
                 break
         self.enable_append()
+        self.enable_remove_plot()
        
     def _on_perspective_selection(self, event=None):
@@ -718,5 +742,5 @@
             perspective.on_perspective(event=None)
         
-    def _on_plot_selection(self, event = None):
+    def _on_plot_selection(self, event=None):
         """
         On source combobox selection
@@ -732,4 +756,27 @@
             panel = combo.GetClientData(selection)
             self.parent.on_set_plot_focus(panel)   
+            
+    def on_close_plot(self, event):
+        """
+        clseo the panel on focus
+        """ 
+        self.enable_append()
+        selection = self.cb_plotpanel.GetSelection()
+        if self.cb_plotpanel.GetValue() != 'None':
+            panel = self.cb_plotpanel.GetClientData(selection)
+            if self.parent is not None and panel is not None:
+                wx.PostEvent(self.parent, 
+                             NewPlotEvent(group_id=panel.group_id,
+                                          action="delete"))
+        self.enable_remove_plot()
+        
+    def enable_remove_plot(self):
+        """
+        enable remove plot button if there is a plot panel on focus
+        """
+        if self.cb_plotpanel.GetCount() == 0:
+            self.bt_close_plot.Disable()
+        else:
+            self.bt_close_plot.Enable()
             
     def enable_remove(self):
@@ -847,4 +894,5 @@
             #self.bt_remove.Hide()
             self.bt_add.Hide() 
+    
            
         
Index: guiframe/gui_manager.py
===================================================================
--- guiframe/gui_manager.py	(revision a03d419257aa974d705140242fbdf985d0e305a8)
+++ guiframe/gui_manager.py	(revision e26d0db750e48c6007a701a55c50b1e267b72b86)
@@ -1180,15 +1180,4 @@
             self._mgr.Update()
             return 
-            if ID in self.panels.keys():
-                del self.panels[ID]
-            if ID in self.plot_panels.keys():
-                del self.plot_panels[ID]
-            if self._data_panel is not None:
-                ind = self._data_panel.cb_plotpanel.FindString(str(caption))
-                if ind != wx.NOT_FOUND:
-                   self._data_panel.cb_plotpanel.Delete(ind)
-            
-            self._mgr.Update()
- 
       
     def clear_panel(self):
@@ -1761,6 +1750,7 @@
         else delete theory
         """
+        temp = data_id + theory_id
         for plug in self.plugins:
-            plug.delete_data(data_id)
+            plug.delete_data(temp)
         total_plot_list = []
         data_list, _ = self._data_manager.get_by_id(data_id)
Index: guiframe/local_perspectives/data_loader/data_loader.py
===================================================================
--- guiframe/local_perspectives/data_loader/data_loader.py	(revision a03d419257aa974d705140242fbdf985d0e305a8)
+++ guiframe/local_perspectives/data_loader/data_loader.py	(revision e26d0db750e48c6007a701a55c50b1e267b72b86)
@@ -67,28 +67,5 @@
                               self._load_folder))
         return menu_list
-    
-    def unused_populate_menu(self, parent):
-        """
-        """
-        # Add menu data 
-        self._data_menu = wx.Menu()
-        #menu for data files
-        data_file_id = wx.NewId()
-        data_file_hint = "load one or more data in the application"
-        self._data_menu.Append(data_file_id, 
-                         '&Load Data File(s)', data_file_hint)
-        wx.EVT_MENU(self.parent, data_file_id, self.load_data)
-        gui_style = self.parent.get_style()
-        style = gui_style & GUIFRAME.MULTIPLE_APPLICATIONS
-        style1 = gui_style & GUIFRAME.DATALOADER_ON
-        if style == GUIFRAME.MULTIPLE_APPLICATIONS:
-            #menu for data from folder
-            data_folder_id = wx.NewId()
-            data_folder_hint = "load multiple data in the application"
-            self._data_menu.Append(data_folder_id, 
-                             '&Load Data Folder', data_folder_hint)
-            wx.EVT_MENU(self.parent, data_folder_id, self._load_folder)
-            
-        return [(self._data_menu, 'Data')]
+   
 
     def load_data(self, event):
Index: guiframe/local_perspectives/plotting/plotting.py
===================================================================
--- guiframe/local_perspectives/plotting/plotting.py	(revision 13a63ab48749452a673cea2a06f239c3cca9d6c6)
+++ guiframe/local_perspectives/plotting/plotting.py	(revision e26d0db750e48c6007a701a55c50b1e267b72b86)
@@ -245,4 +245,5 @@
         if group_id in self.plot_panels.keys():
             panel = self.plot_panels[group_id]
+            uid = panel.uid
             wx.PostEvent(self.parent, 
                          DeletePlotPanelEvent(name=panel.window_caption,
@@ -251,4 +252,5 @@
             self.delete_menu_item(panel.window_caption, panel.uid)
             del self.plot_panels[group_id]
+            self.parent.delete_panel(uid)
             return True
         return False
