コード例 #1
0
ファイル: ipc.py プロジェクト: galdreiman/PAC-FastDownwards
    def __init__(self, squeeze=True, page_size='a4', **kwargs):
        """
        Generate a report similar to the ones used for IPC 2008 and 2011.

        If *squeeze* is True (default) use small fonts to fit in more data.

        *page_size* sets the Latex page size.
        """
        PlanningReport.__init__(self, **kwargs)
        assert len(self.attributes) == 1, self.attributes
        self.attribute = self.attributes[0]
        assert self.attribute in SCORES
        assert page_size in ['a2', 'a3', 'a4']

        self.attribute_name = self.attribute
        self.squeeze = squeeze
        self.page_size = page_size

        self.score = 'score_' + self.attribute
        if self.attribute == 'coverage':
            self.attribute = 'cost'
            self.score = 'coverage'
        elif self.attribute == 'quality':
            self.attribute = 'cost'
            self.score = 'quality'

        self.normalize = True
        self.best_value_column = True
コード例 #2
0
    def __init__(self,
                 show_missing=True,
                 get_category=None,
                 title=None,
                 xscale=None,
                 yscale=None,
                 xlabel='',
                 ylabel='',
                 matplotlib_options=None,
                 **kwargs):
        """

        """
        kwargs.setdefault('format', 'png')
        PlanningReport.__init__(self, **kwargs)
        if len(self.attributes) != 1:
            logging.critical('ScatterPlotReport needs exactly one attribute')
        self.attribute = self.attributes[0]
        # By default all values are in the same category "None".
        self.get_category = get_category or (lambda run1, run2: None)
        self.show_missing = show_missing
        if self.output_format == 'tex':
            self.writer = ScatterPgfplots
        else:
            self.writer = MyMatplotlib
        self.title = title if title is not None else (self.attribute or '')
        self._set_scales(xscale, yscale)
        self.xlabel = xlabel
        self.ylabel = ylabel
        # If the size has not been set explicitly, make it a square.
        self.matplotlib_options = matplotlib_options or {
            'figure.figsize': [8, 8]
        }
        if 'legend.loc' in self.matplotlib_options:
            logging.warning('The "legend.loc" parameter is ignored.')
コード例 #3
0
 def __init__(self, revision_nicks, config_nicks,
              regression_attribute="coverage", **kwargs):
     PlanningReport.__init__(self, **kwargs)
     assert revision_nicks
     self.revision_nicks = revision_nicks
     assert config_nicks
     self.config_nicks = config_nicks
     self.regression_attribute = regression_attribute
コード例 #4
0
 def __init__(self,
              revision_nicks,
              config_nicks,
              regression_attribute="coverage",
              **kwargs):
     PlanningReport.__init__(self, **kwargs)
     assert revision_nicks
     self.revision_nicks = revision_nicks
     assert config_nicks
     self.config_nicks = config_nicks
     self.regression_attribute = regression_attribute
コード例 #5
0
ファイル: best_tabular.py プロジェクト: mzumsteg/downward-lab
 def __init__(self, nbest=5, total=False, **kwargs):
     if "format" not in kwargs:
         kwargs["format"] = "tex"
     elif kwargs["format"] != "tex":
         raise ValueError("unsupported format: {}".format(kwargs["format"]))
     PlanningReport.__init__(self, **kwargs)
     if len(self.attributes) != 1:
         raise ValueError("Report needs exactly one attribute")
     self.attribute = self.attributes[0]
     self.nbest = nbest
     self.total = total
コード例 #6
0
    def __init__(self, timeouts, *args, **kwargs):
        """
        For all runs in the experiment, simulate the timeouts in *timeouts* and
        write a new properties file at *outfile*.

        *timeouts* must be a list of integer timeouts in seconds. ::

            exp.add_report(TimeoutReport([60, 180, 300, 900, 1800]),
                           name='report-timeouts',
                           outfile='timeout-eval/properties')
        """
        PlanningReport.__init__(self, *args, **kwargs)
        self.timeouts = timeouts
コード例 #7
0
ファイル: timeout.py プロジェクト: galdreiman/PAC
    def __init__(self, timeouts, *args, **kwargs):
        """
        For all runs in the experiment, simulate the timeouts in *timeouts* and
        write a new properties file at *outfile*.

        *timeouts* must be a list of integer timeouts in seconds. ::

            exp.add_report(TimeoutReport([60, 180, 300, 900, 1800]),
                           name='report-timeouts',
                           outfile='timeout-eval/properties')
        """
        PlanningReport.__init__(self, *args, **kwargs)
        self.timeouts = timeouts
コード例 #8
0
 def __init__(self, algorithms, evaluator, min_group_size=1, **kwargs):
     PlanningReport.__init__(self, **kwargs)
     if len(set(self.attributes)) != len(self.attributes):
         raise ValueError("Attributes may not appear multiple times")
     if len(algorithms) < 1:
         raise ValueError("Report needs at least one algorithm")
     if len(set(algorithms)) != len(algorithms):
         raise ValueError("Algorithms may not appear multiple times")
     self.algorithm_names = algorithms
     self.algorithm_idx = {alg: i for i, alg in enumerate(algorithms)}
     self.evaluator = evaluator
     # values less than one imply no bound
     self.min_group_size = min_group_size
     evaluator.setReport(self)
コード例 #9
0
 def __init__(self, comparison, min_improvement=0, quantile=0.5, **kwargs):
     kwargs["format"] = "tex"
     PlanningReport.__init__(self, **kwargs)
     if len(self.attributes) != 1:
         raise ValueError("Report needs exactly one attribute")
     if len(comparison) == 0:
         raise ValueError("Report needs at least one comparison")
     self.comparison = {
         id(comp): comp
         for comp in map(_make_comparison_map, comparison)
     }
     self.attribute = self.attributes[0]
     self.min_improvement = min_improvement
     self.quantile = quantile
コード例 #10
0
    def __init__(self, resolution='combined', colored=True, **kwargs):
        """
        *resolution* must be one of "domain" or "problem" or "combined" (default).

        If *colored* is True, the values of each row will be given colors from a
        colormap. Only HTML reports can be colored currently.
        """
        PlanningReport.__init__(self, **kwargs)
        assert resolution in ['domain', 'problem', 'combined']
        self.resolution = resolution
        if colored and 'html' not in self.output_format:
            logging.info('Only HTML reports can be colored. Setting colored=False.')
            colored = False
        self.colored = colored
        self.toc = False
コード例 #11
0
ファイル: absolute.py プロジェクト: galdreiman/PAC
    def __init__(self, resolution="combined", colored=True, **kwargs):
        """
        *resolution* must be one of "domain" or "problem" or "combined" (default).

        If *colored* is True, the values of each row will be given colors from a
        colormap. Only HTML reports can be colored currently.
        """
        PlanningReport.__init__(self, **kwargs)
        assert resolution in ["domain", "problem", "combined"]
        self.resolution = resolution
        if colored and "html" not in self.output_format:
            logging.info("Only HTML reports can be colored. Setting colored=False.")
            colored = False
        self.colored = colored
        self.toc = False
コード例 #12
0
    def __init__(self, sort=False, **kwargs):
        """
        If *sort* is True, sort algorithms from "weakest" to
        "strongest". The "strength" of an algorithm A is the number of
        other algorithms against which A "wins" in a per-domain
        comparison.

        """
        PlanningReport.__init__(self, **kwargs)
        if len(self.attributes) != 1:
            raise ValueError("Report needs exactly one attribute")
        self.attribute = self.attributes[0]
        self.sort = sort
        if self.attribute.min_wins is None:
            raise ValueError(
                "Report needs an Attribute object with min_wins={True,False}")
コード例 #13
0
 def __init__(self, count=100, min=None, max=None, **kwargs):
     if "format" not in kwargs:
         kwargs["format"] = "txt"
     elif kwargs["format"] != "txt":
         raise ValueError("unsupported format: {}".format(kwargs["format"]))
     if min is not None and max is not None and min >= max:
         raise ValueError("min must be below max: {} >= {}".format(
             min, max))
     PlanningReport.__init__(self, **kwargs)
     self.attributes = kwargs["attributes"]
     if len(self.attributes) != 1:
         raise ValueError("Report needs exactly one attribute")
     self.attribute = self.attributes[0]
     self.count = int(count)
     self.min = min
     self.max = max
コード例 #14
0
 def __init__(self,
              algorithm,
              n_best=1,
              n_worst=0,
              eval_attrib="expansions_until_last_jump",
              **kwargs):
     if "format" not in kwargs:
         kwargs["format"] = "txt"
     elif kwargs["format"] != "txt":
         raise ValueError("unsupported format: {}".format(kwargs["format"]))
     kwargs["attributes"] = ["h_split_statistics"]
     PlanningReport.__init__(self, **kwargs)
     self.attribute = self.attributes[0]
     self.algorithm = algorithm
     if n_best <= 0 and n_worst <= 0:
         raise ValueError("Report must select at least one run")
     self.n_best = n_best
     self.n_worst = n_worst
     self.eval_attrib = eval_attrib
     self.min_wins = getattr(eval_attrib, "min_wins", True)
コード例 #15
0
 def __init__(self,
              show_missing=True,
              get_category=None,
              title=None,
              xscale=None,
              yscale=None,
              xlabel='',
              ylabel='',
              search_param=None,
              matplotlib_options=None,
              time_limit=1800,
              **kwargs):
     kwargs.setdefault('format', 'png')
     PlanningReport.__init__(self, **kwargs)
     self.time_limit = time_limit
     self.search_param = search_param
     if len(self.attributes) != 1:
         logging.critical('CactusPlotReport needs exactly one attribute')
     self.attribute = self.attributes[0]
     # By default all values are in the same category "None".
     self.show_missing = show_missing
     if self.output_format == 'tex':
         self.writer = ScatterPgfplots  #TODO
     else:
         self.writer = CactusMatplotlib  #TODO
     self.title = title if title is not None else (
         "Instances solved over time" or '')
     self._set_scales(xscale, yscale)
     self.xlabel = fill(xlabel, 25)
     self.ylabel = fill(ylabel, 25)
     # If the size has not been set explicitly, make it a square.
     self.matplotlib_options = matplotlib_options or {
         'figure.figsize': [8, 8]
     }
     if 'legend.loc' in self.matplotlib_options:
         logging.warning('The "legend.loc" parameter is ignored.')
コード例 #16
0
ファイル: scatter.py プロジェクト: bernardobgam/blocmarket
    def __init__(self,
                 relative=False,
                 show_missing=True,
                 get_category=None,
                 title=None,
                 scale=None,
                 xlabel='',
                 ylabel='',
                 matplotlib_options=None,
                 **kwargs):
        """
        If *relative* is False, create a "standard" scatter plot with a
        diagonal line. If *relative* is True, create a relative scatter
        plot where each point *(x, y)* corresponds to a task for which
        the first algorithm yields a value of *x* and the second
        algorithm yields *x * y*. Relative scatter plots are less common
        in the literature, but often show small differences between
        algorithms better than "standard" scatter plots.

        The keyword argument *attributes* must contain exactly one
        attribute.

        Use the *filter_algorithm* keyword argument to select exactly
        two algorithms (see example below).

        If *show_missing* is False, we only draw a point for an
        algorithm pair if both algorithms have a value.

        *get_category* can be a function that takes **two** runs
        (dictionaries of properties) and returns a category name. This
        name is used to group the points in the plot. If there is more
        than one group, a legend is automatically added. Runs for which
        this function returns None are shown in a default category and
        are not contained in the legend. For example, to group by
        domain:

        >>> def domain_as_category(run1, run2):
        ...     # run2['domain'] has the same value, because we always
        ...     # compare two runs of the same problem.
        ...     return run1['domain']

        Example grouping by difficulty:

        >>> def improvement(run1, run2):
        ...     time1 = run1.get('search_time', 1800)
        ...     time2 = run2.get('search_time', 1800)
        ...     if time1 > time2:
        ...         return 'better'
        ...     if time1 == time2:
        ...         return 'equal'
        ...     return 'worse'

        >>> from downward.experiment import FastDownwardExperiment
        >>> exp = FastDownwardExperiment()
        >>> exp.add_report(ScatterPlotReport(
        ...     attributes=['search_time'],
        ...     get_category=improvement))

        Example comparing the number of expanded states for two
        algorithms:

        >>> exp.add_report(ScatterPlotReport(
        ...         attributes=["expansions_until_last_jump"],
        ...         filter_algorithm=["algorithm-1", "algorithm-2"],
        ...         get_category=domain_as_category,
        ...         format="png",  # Use "tex" for pgfplots output.
        ...         ),
        ...     name="scatterplot-expansions")

        The inherited *format* parameter can be set to 'png' (default),
        'eps', 'pdf', 'pgf' (needs matplotlib 1.2) or 'tex'. For the
        latter a pgfplots plot is created.

        If *title* is given it will be used for the name of the plot.
        Otherwise, the only given attribute will be the title. If none
        is given, there will be no title.

        *scale* can have the values 'linear', 'log' or 'symlog'. If
        omitted, a sensible default will be used for some standard
        attributes and 'log' otherwise. Relative scatter plots always
        use a logarithmic scaling for the *y* axis.

        *xlabel* and *ylabel* are the axis labels.

        *matplotlib_options* may be a dictionary of matplotlib rc
        parameters (see http://matplotlib.org/users/customizing.html):

        >>> from downward.reports.scatter import ScatterPlotReport
        >>> matplotlib_options = {
        ...     'font.family': 'serif',
        ...     'font.weight': 'normal',
        ...     # Used if more specific sizes not set.
        ...     'font.size': 20,
        ...     'axes.labelsize': 20,
        ...     'axes.titlesize': 30,
        ...     'legend.fontsize': 22,
        ...     'xtick.labelsize': 10,
        ...     'ytick.labelsize': 10,
        ...     'lines.markersize': 10,
        ...     'lines.markeredgewidth': 0.25,
        ...     'lines.linewidth': 1,
        ...     # Width and height in inches.
        ...     'figure.figsize': [8, 8],
        ...     'savefig.dpi': 100,
        ... }
        >>> report = ScatterPlotReport(
        ...     attributes=['initial_h_value'],
        ...     matplotlib_options=matplotlib_options)

        You can see the full list of matplotlib options and their
        defaults by executing ::

            import matplotlib
            print(matplotlib.rcParamsDefault)

        """
        kwargs.setdefault('format', 'png')

        # Backwards compatibility.
        xscale = kwargs.pop('xscale', None)
        yscale = kwargs.pop('yscale', None)
        if xscale or yscale:
            logging.warning(
                'Use "scale" parameter instead of "xscale" and "yscale".')
        scale = scale or xscale or yscale

        PlanningReport.__init__(self, **kwargs)
        self.relative = relative
        if len(self.attributes) != 1:
            logging.critical('ScatterPlotReport needs exactly one attribute')
        self.attribute = self.attributes[0]
        # By default all values are in the same category "None".
        self.get_category = get_category or (lambda run1, run2: None)
        self.show_missing = show_missing
        if self.output_format == 'tex':
            self.writer = ScatterPgfplots
        else:
            self.writer = ScatterMatplotlib
        self.title = title if title is not None else (self.attribute or '')
        self._set_scales(scale)
        self.xlabel = xlabel
        self.ylabel = ylabel
        # If the size has not been set explicitly, make it a square.
        self.matplotlib_options = matplotlib_options or {
            'figure.figsize': [8, 8]
        }
        if 'legend.loc' in self.matplotlib_options:
            logging.warning('The "legend.loc" parameter is ignored.')
コード例 #17
0
 def __init__(self, **kwargs):
     kwargs.setdefault('format', 'py')
     PlanningReport.__init__(self, **kwargs)
コード例 #18
0
ファイル: absolute.py プロジェクト: bernardobgam/blocmarket
 def __init__(self, **kwargs):
     PlanningReport.__init__(self, **kwargs)
     self.colored = 'html' in self.output_format
     self.use_domain_links = 'html' in self.output_format
     self.toc = False
コード例 #19
0
    def __init__(self,
                 title=None,
                 xscale=None,
                 yscale=None,
                 xlabel='',
                 ylabel='',
                 matplotlib_options=None,
                 **kwargs):
        """
        The inherited *format* parameter can be set to 'png' (default),
        'eps', 'pdf', 'pgf' (needs matplotlib 1.2) or 'tex'. For the
        latter a pgfplots plot is created.

        If *title* is given it will be used for the name of the plot.
        Otherwise, the only given attribute will be the title. If none
        is given, there will be no title.

        *xscale* and *yscale* can have the values 'linear', 'log' or
        'symlog'. If omitted sensible defaults will be used.

        *xlabel* and *ylabel* are the axis labels.

        *matplotlib_options* may be a dictionary of matplotlib rc
        parameters (see http://matplotlib.org/users/customizing.html):

        >>> from downward.reports.scatter import ScatterPlotReport
        >>> matplotlib_options = {
        ...     'font.family': 'serif',
        ...     'font.weight': 'normal',
        ...     # Used if more specific sizes not set.
        ...     'font.size': 20,
        ...     'axes.labelsize': 20,
        ...     'axes.titlesize': 30,
        ...     'legend.fontsize': 22,
        ...     'xtick.labelsize': 10,
        ...     'ytick.labelsize': 10,
        ...     'lines.markersize': 10,
        ...     'lines.markeredgewidth': 0.25,
        ...     'lines.linewidth': 1,
        ...     # Width and height in inches.
        ...     'figure.figsize': [8, 8],
        ...     'savefig.dpi': 100,
        ... }
        >>> report = ScatterPlotReport(
        ...     attributes=['initial_h_value'],
        ...     matplotlib_options=matplotlib_options)

        You can see the full list of matplotlib options and their
        defaults by executing ::

            import matplotlib
            print matplotlib.rcParamsDefault

        """
        kwargs.setdefault('format', 'png')
        PlanningReport.__init__(self, **kwargs)
        assert len(self.attributes) <= 1, self.attributes
        self.attribute = None
        if self.attributes:
            self.attribute = self.attributes[0]
        self.title = title if title is not None else (self.attribute or '')

        self.category_styles = {}
        self._set_scales(xscale, yscale)
        self.xlabel = xlabel
        self.ylabel = ylabel
        self.xlim_left = None
        self.xlim_right = None
        self.ylim_bottom = None
        self.ylim_top = None
        self.matplotlib_options = matplotlib_options or {}
        if 'legend.loc' in self.matplotlib_options:
            logging.warning('The "legend.loc" parameter is ignored.')
        if self.output_format == 'tex':
            self.writer = PgfPlots
        else:
            self.writer = Matplotlib
コード例 #20
0
 def __init__(self, **kwargs):
     PlanningReport.__init__(self, **kwargs)
コード例 #21
0
ファイル: MyPlot.py プロジェクト: galdreiman/PAC
    def __init__(self, title=None, xscale=None, yscale=None, xlabel='', ylabel='',
                 xlim_left=None, xlim_right=None, ylim_bottom=None, ylim_top=None,
                 legend_location='upper right', category_styles=None, params=None,
                 **kwargs):
        """
        The inherited *format* parameter can be set to 'png' (default), 'eps',
        'pdf', 'pgf' (needs matplotlib 1.2) or 'tex'. For the latter a pgfplots
        plot is created.

        If *title* is given it will be used for the name of the plot.
        Otherwise, the only given attribute will be the title. If none is given,
        there will be no title.

        *xscale* and *yscale* can have the values 'linear', 'log' or 'symlog'.
        If omitted sensible defaults will be used.

        *legend_location* must be a (x, y) pair or one of the following:
        'upper right', 'upper left', 'lower left', 'lower right', 'right',
        'center left', 'center right', 'lower center', 'upper center',
        'center'. If *legend_location* is None, no legend will be added. ::

            # Some example positions.
            legend_location='lower left'  # Lower left corner *inside* the plot
            legend_location=(1.1, 0.5)    # Right of the plot
            legend_location=(0.5, 1.1)    # Above the plot
            legend_location=(0.5, -0.1)   # Below the plot

        Subclasses may group the data points into categories. These categories
        are separated visually by drawing them with different styles. You can
        set the styles manually by providing a dictionary *category_styles* that
        maps category names to dictionaries of matplotlib drawing parameters
        (see http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.plot).
        For example to change the default style to blue stars use::

            ScatterPlotReport(attributes=['expansions'],
                              category_styles={None: {'marker': '*', 'c': 'b'}})

        *params* may be a dictionary of matplotlib rc parameters
        (see http://matplotlib.org/users/customizing.html)::

            params = {
                'font.family': 'serif',
                'font.weight': 'normal',
                'font.size': 20,  # Used if the more specific sizes are not set.
                'axes.labelsize': 20,
                'axes.titlesize': 30,
                'legend.fontsize': 22,
                'xtick.labelsize': 10,
                'ytick.labelsize': 10,
                'lines.markersize': 10,
                'lines.markeredgewidth': 0.25,
                'lines.linewidth': 1,
                'figure.figsize': [8, 8],  # Width and height in inches.
                'savefig.dpi': 100,
            }
            ScatterPlotReport(attributes=['initial_h_value'], params=params)
        """
        kwargs.setdefault('format', 'png')
        PlanningReport.__init__(self, **kwargs)
        assert len(self.attributes) <= 1, self.attributes
        self.attribute = None
        if self.attributes:
            self.attribute = self.attributes[0]
        self.title = title if title is not None else (self.attribute or '')
        self.legend_location = legend_location

        # Convert the old (marker, color) tuples to the new dict format.
        category_styles = category_styles or {}
        used_old_format = False
        for cat, style in category_styles.items():
            if not isinstance(style, dict):
                assert isinstance(style, (tuple, list)), style
                used_old_format = True
                marker, color = style
                category_styles[cat] = {'marker': marker, 'c': color}
                logging.info('Converted %s to %s' % (style, category_styles[cat]))
        if used_old_format:
            logging.warning('The old category_styles tuple format has been '
                            'deprecated. You should use a dictionary mapping '
                            'category names to dictionaries of matplotlib params '
                            'instead: %s' % category_styles[cat])

        self.category_styles = category_styles
        self._set_scales(xscale, yscale)
        self.xlabel = xlabel
        self.ylabel = ylabel
        self.xlim_left = 0.7
        self.xlim_right = 2.8
        self.ylim_bottom = 0
        self.ylim_top = 110
        self.params = params or {}
        if self.output_format == 'tex':
            self.writer = PgfPlots
        else:
            self.writer = Matplotlib
コード例 #22
0
    def __init__(self,
                 title=None,
                 xscale=None,
                 yscale=None,
                 xlabel='',
                 ylabel='',
                 xlim_left=None,
                 xlim_right=None,
                 ylim_bottom=None,
                 ylim_top=None,
                 legend_location='upper right',
                 category_styles=None,
                 params=None,
                 **kwargs):
        """
        The inherited *format* parameter can be set to 'png' (default), 'eps',
        'pdf', 'pgf' (needs matplotlib 1.2) or 'tex'. For the latter a pgfplots
        plot is created.

        If *title* is given it will be used for the name of the plot.
        Otherwise, the only given attribute will be the title. If none is given,
        there will be no title.

        *xscale* and *yscale* can have the values 'linear', 'log' or 'symlog'.
        If omitted sensible defaults will be used.

        *legend_location* must be a (x, y) pair or one of the following:
        'upper right', 'upper left', 'lower left', 'lower right', 'right',
        'center left', 'center right', 'lower center', 'upper center',
        'center'. If *legend_location* is None, no legend will be added. ::

            # Some example positions.
            legend_location='lower left'  # Lower left corner *inside* the plot
            legend_location=(1.1, 0.5)    # Right of the plot
            legend_location=(0.5, 1.1)    # Above the plot
            legend_location=(0.5, -0.1)   # Below the plot

        Subclasses may group the data points into categories. These categories
        are separated visually by drawing them with different styles. You can
        set the styles manually by providing a dictionary *category_styles* that
        maps category names to dictionaries of matplotlib drawing parameters
        (see http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.plot).
        For example to change the default style to blue stars use::

            ScatterPlotReport(attributes=['expansions'],
                              category_styles={None: {'marker': '*', 'c': 'b'}})

        *params* may be a dictionary of matplotlib rc parameters
        (see http://matplotlib.org/users/customizing.html)::

            params = {
                'font.family': 'serif',
                'font.weight': 'normal',
                'font.size': 20,  # Used if the more specific sizes are not set.
                'axes.labelsize': 20,
                'axes.titlesize': 30,
                'legend.fontsize': 22,
                'xtick.labelsize': 10,
                'ytick.labelsize': 10,
                'lines.markersize': 10,
                'lines.markeredgewidth': 0.25,
                'lines.linewidth': 1,
                'figure.figsize': [8, 8],  # Width and height in inches.
                'savefig.dpi': 100,
            }
            ScatterPlotReport(attributes=['initial_h_value'], params=params)
        """
        kwargs.setdefault('format', 'png')
        PlanningReport.__init__(self, **kwargs)
        assert len(self.attributes) <= 1, self.attributes
        self.attribute = None
        if self.attributes:
            self.attribute = self.attributes[0]
        self.title = title if title is not None else (self.attribute or '')
        self.legend_location = legend_location

        # Convert the old (marker, color) tuples to the new dict format.
        category_styles = category_styles or {}
        used_old_format = False
        for cat, style in category_styles.items():
            if not isinstance(style, dict):
                assert isinstance(style, (tuple, list)), style
                used_old_format = True
                marker, color = style
                category_styles[cat] = {'marker': marker, 'c': color}
                logging.info('Converted %s to %s' %
                             (style, category_styles[cat]))
        if used_old_format:
            logging.warning(
                'The old category_styles tuple format has been '
                'deprecated. You should use a dictionary mapping '
                'category names to dictionaries of matplotlib params '
                'instead: %s' % category_styles[cat])

        self.category_styles = category_styles
        self._set_scales(xscale, yscale)
        self.xlabel = xlabel
        self.ylabel = ylabel
        self.xlim_left = xlim_left
        self.xlim_right = xlim_right
        self.ylim_bottom = ylim_bottom
        self.ylim_top = ylim_top
        self.params = params or {}
        if self.output_format == 'tex':
            self.writer = PgfPlots
        else:
            self.writer = Matplotlib
コード例 #23
0
ファイル: sortedreport.py プロジェクト: Eldeeqq/bi-zum
 def __init__(self, sort_spec, **kwargs):
     PlanningReport.__init__(self, **kwargs)
     self._sort_spec = sort_spec