Changeset 377


Ignore:
Timestamp:
02/08/05 09:22:34 (19 years ago)
Author:
mar637
Message:
  • added user controlled set_layout
  • added save
  • added help for set_mode
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r282 r377  
    77    By default the plotter is set up to plot polarisations
    88    'colour stacked' and scantables across panels.
    9     The defaul plotter is called 'plotter'.
    109    Note:
    1110        Currenly it only plots 'spectra' not Tsys or
     
    3433        self._panels = 's'
    3534        self._stacking = rcParams['plotter.stacking']
     35        self._rows = None
     36        self._cols = None
    3637        self._autoplot = False
    3738        self._minmax = None
     
    9091        self._plotter.set_panels()
    9192        if n > 1:
    92             self._plotter.set_panels(rows=n)
     93            if self._rows and self._cols:
     94                n = min(n,self._rows*self._cols)
     95                self._plotter.set_panels(rows=self._rows,cols=self._cols,
     96                                         nplots=n)
     97            else:
     98                self._plotter.set_panels(rows=n,cols=0)
    9399        for i in range(n):
    94100            if n > 1:
    95                 self._plotter.palette(0)
     101                self._plotter.palette(1)
    96102                self._plotter.subplot(i)
    97103            for j in range(ncol):
     
    140146        self._plotter.set_panels()
    141147        if n > 1:
    142             self._plotter.set_panels(rows=n)
     148            if self._rows and self._cols:
     149                n = min(n,self._rows*self._cols)
     150                self._plotter.set_panels(rows=self._rows,cols=self._cols,
     151                                         nplots=n)
     152            else:
     153                self._plotter.set_panels(rows=n,cols=0)
    143154        i = 0
    144155        for scan in scans:
     
    190201        self._plotter.set_panels()
    191202        if n > 1:
    192             self._plotter.set_panels(rows=n)
     203            if self._rows and self._cols:
     204                n = min(n,self._rows*self._cols)
     205                self._plotter.set_panels(rows=self._rows,cols=self._cols,
     206                                         nplots=n)
     207            else:
     208                self._plotter.set_panels(rows=n,cols=0)
    193209        for i in range(n):
    194210            if n>1:
     
    248264    def set_mode(self, stacking=None, panelling=None):
    249265        """
     266        Set the plots look and feel, i.e. what you want to see on the plot.
    250267        Parameters:
    251268            stacking:     tell the plotter which variable to plot
     
    270287        return
    271288
    272     def set_panels(self, what=None):       
     289    def set_panels(self, what=None):
     290        """       
     291        """
    273292        if not what:
    274293             what = rcParams['plotter.panelling']
     
    279298            return True
    280299        return False
     300
     301    def set_layout(self,rows=None,cols=None):
     302        """
     303        Set the multi-panel layout, i.e. how many rows and columns plots
     304        are visible.
     305        Parameters:
     306             rows:   The number of rows of plots
     307             cols:   The number of columns of plots
     308        Note:
     309             If no argument is given, the potter reverts to its auto-plot
     310             behaviour.
     311        """
     312        self._rows = rows
     313        self._cols = cols
     314        if self._data: self.plot()
     315        return
    281316
    282317    def set_stacking(self, what=None): 
     
    343378        return
    344379
    345        
     380    def save(self, filename=None):
     381        """
     382        Save the plot to a file. The know formats are 'png', 'ps', 'eps'.
     383        Parameters:
     384             filename:    The name of the output file. This is optional
     385                          and autodetects the image format from the file
     386                          suffix. If non filename is specified a file
     387                          called 'yyyymmdd_hhmmss.png' is created in the
     388                          current directory.
     389        """
     390        self._plotter.save(filename)
     391        return
    346392
    347393if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.