Changeset e4a703a in sasview for sansguiframe/src/sans/guiframe


Ignore:
Timestamp:
Aug 30, 2011 7:15:37 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
fe48fcc
Parents:
5eede4e
Message:

keep the xylimit on update plot

Location:
sansguiframe/src/sans/guiframe/local_perspectives/plotting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py

    r5eede4e re4a703a  
    228228        """ 
    229229        if data.id in self.plots.keys(): 
    230             #replace except label  
     230            #Recover panel prop.s 
     231            xlo, xhi = self.subplot.get_xlim() 
     232            ylo, yhi = self.subplot.get_ylim() 
    231233            old_data = self.plots[data.id] 
    232234            data.label = old_data.label 
    233235            data.custom_color = old_data.custom_color 
     236            # Replace data 
    234237            self.graph.replace(data) 
    235238            self.plots[data.id] = data 
     239            ## Set the view scale for all plots 
     240            self._onEVT_FUNC_PROPERTY() 
     241            # Recover the x,y limits 
     242            self.subplot.set_xlim((xlo, xhi))      
     243            self.subplot.set_ylim((ylo, yhi))   
    236244        else: 
    237245            self.plots[data.id] = data 
    238246            self.graph.add(self.plots[data.id])  
    239          
    240         ## Set the view scale for all plots 
    241         self._onEVT_FUNC_PROPERTY() 
    242      
     247            ## Set the view scale for all plots 
     248            self._onEVT_FUNC_PROPERTY() 
     249         
     250           
    243251    def draw_plot(self): 
    244252        """ 
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py

    rfe857e2 re4a703a  
    166166        :param event: data event 
    167167        """ 
     168        xlo = None 
     169        xhi = None 
     170        ylo = None  
     171        yhi = None 
    168172        ## Update self.data2d with the current plot 
    169173        self.data2D = data 
    170174        if data.id in self.plots.keys(): 
    171175            #replace 
     176            xlo, xhi = self.subplot.get_xlim() 
     177            ylo, yhi = self.subplot.get_ylim() 
    172178            self.graph.replace(data) 
    173179            self.plots[data.id] = data 
     
    199205        self.default_zmin_ctl = self.zmin_2D 
    200206        self.default_zmax_ctl = self.zmax_2D 
     207        # Recover the x,y limits 
     208        if (xlo and xhi and ylo and yhi) != None: 
     209            if (xlo > data.xmin and xhi < data.xmax and\ 
     210                        ylo > data.ymin and yhi < data.ymax): 
     211                self.subplot.set_xlim((xlo, xhi))      
     212                self.subplot.set_ylim((ylo, yhi))   
    201213 
    202214    def onContextMenu(self, event): 
Note: See TracChangeset for help on using the changeset viewer.