Changeset f2f6af9 in sasview


Ignore:
Timestamp:
Aug 10, 2016 9:25:57 AM (8 years ago)
Author:
lewis
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:
09d6719
Parents:
d2fd8fc
Message:

Set ylim when scale changed to Porod

Location:
src/sas/sasgui/plottools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/plottools/PlotPanel.py

    rdd5bf63 rf2f6af9  
    12111211 
    12121212        # Properties defined by plot 
    1213          
     1213 
    12141214        # Ricardo: 
    1215         # A empty label "$$" will prevent the panel from displaying!  
    1216          
     1215        # A empty label "$$" will prevent the panel from displaying! 
    12171216        if prop["xlabel"]: 
    12181217            self.subplot.set_xlabel(r"$%s$"%prop["xlabel"]) 
    12191218        if prop["ylabel"]: 
    12201219            self.subplot.set_ylabel(r"$%s$"%prop["ylabel"]) 
     1220        if prop["xlim"] is not None: 
     1221            self.subplot.set_xlim(prop["xlim"]) 
     1222        if prop["ylim"] is not None: 
     1223            self.subplot.set_ylim(prop["ylim"]) 
    12211224        self.subplot.set_title(prop["title"]) 
    1222          
     1225 
    12231226 
    12241227    def clear(self): 
     
    15641567                                                  bins=[self.y_bins, self.x_bins], 
    15651568                                                  weights=self.data) 
    1566         # Now, normalize the image by weights only for weights>1:  
     1569        # Now, normalize the image by weights only for weights>1: 
    15671570        # If weight == 1, there is only one data point in the bin so 
    15681571        # that no normalization is required. 
     
    17591762        _yscale = 'linear' 
    17601763        for item in list: 
     1764            set_ylim = False # Whether to set ylim based on data points or error bars 
    17611765            item.setLabel(self.xLabel, self.yLabel) 
    1762  
    17631766            # control axis labels from the panel itself 
    17641767            yname, yunits = item.get_yaxis() 
     
    18191822                self.graph._yaxis_transformed("1/%s" % yname, "%s" % yunits) 
    18201823            if self.yLabel == "y*x^(4)": 
     1824                set_ylim = True 
    18211825                item.transformY(transform.toYX4, transform.errToYX4) 
    18221826                xunits = convert_unit(4, self.xaxis_unit) 
     
    18631867                                              "%s%s" % (yunits, xunits)) 
    18641868            item.transformView() 
     1869            if set_ylim: 
     1870                self.graph.ylim((min(item.view.y), max(item.view.y))) 
     1871            else: 
     1872                self.graph.ylim(None) 
    18651873 
    18661874        # set new label and units 
  • src/sas/sasgui/plottools/plottables.py

    rcd54205 rf2f6af9  
    157157        self.prop["xunit_base"] = units 
    158158 
     159    def xlim(self, xlim): 
     160        """ 
     161        Set the limits of the x axis to (min, max). 
     162        """ 
     163        self.prop["xlim"] = xlim 
     164 
    159165    def yaxis(self, name, units): 
    160166        """ 
     
    167173        self.prop["ylabel_base"] = name 
    168174        self.prop["yunit_base"] = units 
     175 
     176    def ylim(self, ylim): 
     177        """ 
     178        Set the limits of the y axis to (min, max). 
     179        """ 
     180        self.prop["ylim"] = ylim 
    169181 
    170182    def title(self, name): 
     
    266278        self.prop = {"xlabel": "", "xunit": None, 
    267279                     "ylabel": "", "yunit": None, 
     280                     "xlim": None, "ylim": None, 
    268281                     "title": ""} 
    269282        self.plottables = {} 
Note: See TracChangeset for help on using the changeset viewer.