Ignore:
Timestamp:
03/13/11 14:38:13 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:

  • Renamed a method asapplotter.set_panellayout to asapplotter.set_margin.
  • Renamed a parameter layout to margin in asapplotter.set_margin and

asaplotbase.set_panels.

Test Programs: call asapplotter.set_margin(margin=[0.1,0.1])

Put in Release Notes: Yes

Module(s): asapplotter, asaplotbase, and sdplot

Description:

  • Renamed a method asapplotter.set_panellayout to asapplotter.set_margin.
  • Renamed a parameter layout to margin in asapplotter.set_margin and

asaplotbase.set_panels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r2011 r2037  
    5050        self._hist = rcParams['plotter.histogram']
    5151        self._fp = FontProperties()
    52         self._panellayout = self.set_panellayout(refresh=False)
     52        self._margins = self.set_margin(refresh=False)
    5353        self._offset = None
    5454        self._startrow = 0
     
    641641        if refresh and self._data: self.plot(self._data)
    642642
    643     def set_panellayout(self,layout=[],refresh=True):
    644         """
    645         Set the layout of subplots.
    646         Parameters:
    647             layout:   a list of subplots layout in figure coordinate (0-1),
     643    def set_margin(self,margin=[],refresh=True):
     644        """
     645        Set margins between subplots and plot edges.
     646        Parameters:
     647            margin:   a list of margins in figure coordinate (0-1),
    648648                      i.e., fraction of the figure width or height.
    649649                      The order of elements should be:
     
    654654                      Otherwise,the parameter(s) are set without replotting.
    655655        Note
    656         * When layout is not specified, the values are reset to the defaults
     656        * When margin is not specified, the values are reset to the defaults
    657657          of matplotlib.
    658658        * If any element is set to be None, the current value is adopted.
    659659        """
    660         if layout == []: self._panellayout=self._reset_panellayout()
     660        if margin == []: self._margins=self._reset_margin()
    661661        else:
    662             self._panellayout=[None]*6
    663             self._panellayout[0:len(layout)]=layout
    664         #print "panel layout set to ",self._panellayout
     662            self._margins=[None]*6
     663            self._margins[0:len(margin)]=margin
     664        #print "panel margin set to ",self._margins
    665665        if refresh and self._data: self.plot(self._data)
    666666
    667     def _reset_panellayout(self):
     667    def _reset_margin(self):
    668668        ks=map(lambda x: 'figure.subplot.'+x,
    669669               ['left','bottom','right','top','hspace','wspace'])
     
    887887                n = min(n,self._rows*self._cols)
    888888                self._plotter.set_panels(rows=self._rows,cols=self._cols,
    889                                          nplots=n,layout=self._panellayout,ganged=ganged)
     889                                         nplots=n,margin=self._margins,ganged=ganged)
    890890            else:
    891                 self._plotter.set_panels(rows=n,cols=0,nplots=n,layout=self._panellayout,ganged=ganged)
     891                self._plotter.set_panels(rows=n,cols=0,nplots=n,margin=self._margins,ganged=ganged)
    892892        else:
    893             self._plotter.set_panels(layout=self._panellayout)
     893            self._plotter.set_panels(margin=self._margins)
    894894        #r = 0
    895895        r = self._startrow
     
    11501150        PL.ioff()
    11511151        PL.clf()
    1152         # Adjust subplot layouts
    1153         if len(self._panellayout) != 6:
    1154             self.set_panellayout(refresh=False)
    1155         lef, bot, rig, top, wsp, hsp = self._panellayout
     1152        # Adjust subplot margins
     1153        if len(self._margins) != 6:
     1154            self.set_margin(refresh=False)
     1155        lef, bot, rig, top, wsp, hsp = self._margins
    11561156        PL.gcf().subplots_adjust(left=lef,bottom=bot,right=rig,top=top,
    11571157                                 wspace=wsp,hspace=hsp)
     
    12501250        #PL.ioff()
    12511251        PL.clf()
    1252         # Adjust subplot layouts
    1253         if len(self._panellayout) != 6:
    1254             self.set_panellayout(refresh=False)
    1255         lef, bot, rig, top, wsp, hsp = self._panellayout
     1252        # Adjust subplot margins
     1253        if len(self._margins) != 6:
     1254            self.set_margin(refresh=False)
     1255        lef, bot, rig, top, wsp, hsp = self._margins
    12561256        PL.gcf().subplots_adjust(left=lef,bottom=bot,right=rig,top=top,
    12571257                                 wspace=wsp,hspace=hsp)
     
    13021302        #    self._datamask = None
    13031303
    1304         # Adjust subplot layouts
    1305         if len(self._panellayout) !=6: self.set_panellayout(refresh=False)
    1306         lef, bot, rig, top, wsp, hsp = self._panellayout
     1304        # Adjust subplot margins
     1305        if len(self._margins) !=6: self.set_margin(refresh=False)
     1306        lef, bot, rig, top, wsp, hsp = self._margins
    13071307        self._plotter.figure.subplots_adjust(
    13081308            left=lef,bottom=bot,right=rig,top=top,wspace=wsp,hspace=hsp)
Note: See TracChangeset for help on using the changeset viewer.