Ignore:
Timestamp:
01/07/13 19:29:32 (11 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No (minor improvements)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: added a 'private' method, _subplotOk,

to check subplot layout in asaplotbase class.

Test Programs: do page iteration

Put in Release Notes: No

Module(s): asaplotbase, asapplotter, and sdplot

Description:

Implemented a better procedure to check if re-generation of
subplot instanses are necessary in page iteration.
Also, reset page counter when layout is changed by asapplotter.set_layout.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotbase.py

    r2700 r2715  
    99from matplotlib.figure import Figure, Text
    1010from matplotlib.font_manager import FontProperties as FP
    11 from numpy import sqrt
     11from numpy import sqrt, ceil
    1212from matplotlib import rc, rcParams
    1313from matplotlib.ticker import OldScalarFormatter
     
    100100        return False
    101101
     102    def _subplotsOk(self, rows, cols, npanel=0):
     103        """
     104        Check if the axes in subplots are actually the ones plotted on
     105        the figure. Returns a bool.
     106        This method is to detect manual layout changes using mpl methods.
     107        """
     108        # compare with user defined layout
     109        if (rows is not None) and (rows != self.rows):
     110            return False
     111        if (cols is not None) and (cols != self.cols):
     112            return False
     113        # check number of subplots
     114        figaxes = self.figure.get_axes()
     115        np = self.rows*self.cols
     116        if npanel > np:
     117            return False
     118        if len(figaxes) != np:
     119            return False
     120        if len(self.subplots) != len(figaxes):
     121            return False
     122        # compare axes instance in this class and on the plotter
     123        ok = True
     124        for ip in range(np):
     125            if self.subplots[ip]['axes'] != figaxes[ip]:
     126                ok = False
     127                break
     128        return ok
    102129
    103130    ### Delete artists ###
Note: See TracChangeset for help on using the changeset viewer.