예제 #1
0
    def plot(self, ax, ymin, ymax, extra_options):
        # self.print_values()

        # scatter plot
        x_axis = list(range(len(self.values0)))
        colors0, colors3 = self.generate_colors()
        ax.scatter(x=x_axis, y=self.values0, c=colors0, zorder=self.values0)
        ax.scatter(x=x_axis, y=self.values3, c=colors3, zorder=self.values3)
        ax.grid(b=True, color=PlotConstants.COLOR_SILVER)
        ax.set_axisbelow(True)

        if ymax >= self.base_value0:
            PlotUtils.horizontal_line(ax, self.base_value0,
                                      PlotConstants.COLOR_SILVER)

        RelativeDifferencePlot.set_lim(ax, ymin, ymax)

        if extra_options['first_row']:
            ax.title.set_text(self.algorithm)
        if not extra_options['last_row']:
            ax.set_xticklabels([])
        if extra_options['first_column']:
            ax.set_ylabel('Total Bits')
            self.format_x_ticks(ax)
        else:
            ax.set_yticklabels([])
예제 #2
0
 def _labels(self, ax, options):
     CommonPlot.label_title(ax, options, self.algorithm)
     CommonPlot.label_y(ax, options, PlotConstants.WINDOW_SIZE,
                        ExperimentsUtils.WINDOWS)
     CommonPlot.label_x(ax, options, PlotConstants.ERROR_THRE,
                        ExperimentsUtils.THRESHOLDS)
     PlotUtils.hide_ticks(ax)
예제 #3
0
 def _labels(self, ax, options):
     CommonPlot.label_title(ax, options, self.algorithm)
     tick_labels = self.ytick_labels(ax)
     CommonPlot.label_y(ax, options, PlotConstants.COMPRESSION_RATIO,
                        tick_labels)
     CommonPlot.label_x(ax, options, PlotConstants.ERROR_THRE,
                        ExperimentsUtils.THRESHOLDS)
     PlotUtils.hide_ticks(ax)
예제 #4
0
    def plot(self, ax, ymin, ymax, extra_options={}):
        # self.print_values()
        extra_options.update(self.options)
        self.options = extra_options

        assert (len(self.values3) > 0)
        two_sets = len(self.values0) > 0

        # scatter plot
        x_axis = list(range(len(self.values3)))
        if two_sets:
            colors0, colors3 = self.generate_colors(False)
            label0, label3 = self.options.get('labels')
            ax.scatter(x=x_axis,
                       y=self.values0,
                       c=colors0,
                       zorder=1,
                       marker='x',
                       label=label0,
                       s=36)
            ax.scatter(x=x_axis,
                       y=self.values3,
                       c=colors3,
                       zorder=2,
                       marker='.',
                       label=label3,
                       s=10)
            ax.legend(loc='upper right',
                      bbox_to_anchor=(0.5, 0., 0.48, 0.95),
                      fontsize='small',
                      edgecolor='black',
                      scatterpoints=1,
                      handlelength=1)
        else:
            y_axis = self.values3
            size = len(y_axis)
            x_axis = list(range(size))
            opt = self.options['pdf_instance'].add_data(
                'compression', self.algorithm, y_axis)
            CommonPlot.scatter_plot(ax, x_axis, y_axis, size,
                                    self.value3_color, opt)

        ax.set_xticks(x_axis)
        ax.grid(b=True,
                color=PlotConstants.COLOR_SILVER,
                linestyle='dotted',
                zorder=0)
        ax.set_axisbelow(True)

        if ymax >= 100:
            PlotUtils.horizontal_line(ax, 100, PlotConstants.COLOR_SILVER)

        CommonPlot.set_lim(ax, ymin, ymax)
        self._labels(ax, self.options)
예제 #5
0
 def __init__(self, panda_utils_NM, panda_utils_M, filename, pdf_instance):
     self.panda_utils_NM = panda_utils_NM
     self.panda_utils_M = panda_utils_M
     self.filename = filename
     self.pdf_instance = pdf_instance
     self.col_index = pdf_instance.col_index
     self.plots_options = pdf_instance.plot_options() or pdf_instance.PLOT_OPTIONS or {}
     self.fig, self.plt = PlotUtils.create_figure(pdf_instance.FIG_SIZE_H_V, filename + ' - col = ' + str(self.col_index))
     self.height_ratios = pdf_instance.HEIGHT_RATIOS
예제 #6
0
 def __check_sorted(self):
     if self.additional_checks:
         assert (PlotUtils.sorted_dec(self.values0))
         assert (PlotUtils.sorted_dec(self.values3))
예제 #7
0
 def __check_sorted(self):
     if self.additional_checks and self.algorithm != "CoderPCA":
         assert (PlotUtils.sorted(self.values0))
         assert (PlotUtils.sorted(self.values3))