コード例 #1
0
ファイル: simple_plot.py プロジェクト: brainscales/mozaik
    def _ticks(self):
        if self.x_ticks != None and self.x_tick_style == 'Custom':
            if self.x_tick_labels != None and (len(self.x_ticks) == len(
                    self.x_tick_labels)):
                pylab.xticks(self.x_ticks, self.x_tick_labels)
            else:
                pylab.xticks(self.x_ticks)
                phf.remove_x_tick_labels()
        else:
            if self.x_tick_style == 'Min':
                phf.three_tick_axis(self.axis.xaxis)
            elif self.x_tick_style == 'Custom':
                phf.disable_xticks(self.axis)
                phf.remove_x_tick_labels()
            else:
                raise ValueError('Unknown x tick style %s', self.x_tick_style)

        if self.y_ticks != None and self.x_tick_style == 'Custom':
            if self.y_tick_labels != None and (len(self.y_ticks) == len(
                    self.y_tick_labels)):
                pylab.yticks(self.y_ticks, self.y_tick_labels)
            else:
                pylab.yticks(self.y_ticks)
                phf.remove_y_tick_labels()
        else:
            if self.y_tick_style == 'Min':
                phf.three_tick_axis(self.axis.yaxis)
            elif self.y_tick_style == 'Custom':
                phf.disable_yticks(self.axis)
                phf.remove_y_tick_labels()
            else:
                raise ValueError('Unknow y tick style %s', self.y_tick_style)

        for label in self.axis.get_xticklabels() + self.axis.get_yticklabels():
            label.set_fontsize(self.fontsize)
コード例 #2
0
ファイル: simple_plot.py プロジェクト: brainscales/mozaik
    def _ticks(self):
        if self.x_ticks != None and self.x_tick_style == 'Custom':
            if self.x_tick_labels != None and (len(self.x_ticks) == len(self.x_tick_labels)):
                pylab.xticks(self.x_ticks, self.x_tick_labels)
            else:
                pylab.xticks(self.x_ticks)
                phf.remove_x_tick_labels()
        else:    
            if self.x_tick_style == 'Min':
                phf.three_tick_axis(self.axis.xaxis)
            elif self.x_tick_style == 'Custom':                
               phf.disable_xticks(self.axis)
               phf.remove_x_tick_labels()
            else:
                raise ValueError('Unknown x tick style %s', self.x_tick_style)

        if self.y_ticks != None and self.x_tick_style == 'Custom':
            if self.y_tick_labels != None and (len(self.y_ticks) == len(self.y_tick_labels)):
                pylab.yticks(self.y_ticks, self.y_tick_labels)
            else:
                pylab.yticks(self.y_ticks)
                phf.remove_y_tick_labels()
        else:
            if self.y_tick_style == 'Min':
                phf.three_tick_axis(self.axis.yaxis)
            elif self.y_tick_style == 'Custom':                
               phf.disable_yticks(self.axis)
               phf.remove_y_tick_labels()
            else:
                raise ValueError('Unknow y tick style %s', self.y_tick_style)

        for label in self.axis.get_xticklabels() + self.axis.get_yticklabels():
            label.set_fontsize(self.fontsize)
コード例 #3
0
    def post_plot(self):
       
        if self.title != None:
            pylab.title(self.title, fontsize=self.fontsize)
        
        
        if self.x_scale:
            pylab.xscale(self.x_scale)
            if self.x_scale_base:
                pylab.xscale(self.x_scale, basex=self.x_scale_base)
        
        if self.y_scale:
            pylab.yscale(self.y_scale)
            if self.y_scale_base:
                pylab.yscale(self.y_scale, basey=self.y_scale_base)

        if not self.x_axis:
            phf.disable_xticks(self.axis)
            phf.remove_x_tick_labels()
        if not self.y_axis:
            phf.disable_yticks(self.axis)
            phf.remove_y_tick_labels()

        if self.x_lim:
            pylab.xlim(self.x_lim)
        if self.y_lim:
            pylab.ylim(self.y_lim)

        self._ticks()


        if self.y_label and self.y_axis:
            pylab.ylabel(self.y_label,multialignment='center',fontsize=self.fontsize,labelpad=self.y_label_pad)
        if self.x_label and self.x_axis:
            pylab.xlabel(self.x_label,multialignment='center',fontsize=self.fontsize,labelpad=self.x_label_pad)
        if not self.top_right_border:
            phf.disable_top_right_axis(self.axis)
        if not self.left_border:
            phf.disable_left_axis(self.axis)
        if not self.bottom_border:
            phf.disable_bottom_axis(self.axis)

        if self.grid:
            self.axis.grid(True)

        
        pylab.rc('axes', linewidth=1)
        pylab.rcParams['xtick.major.pad'] = self.xtick_pad_backup
        pylab.rcParams['ytick.major.pad'] = self.ytick_pad_backup
        pylab.rcParams['axes.color_cycle'] =self.colormap_backup
コード例 #4
0
ファイル: simple_plot.py プロジェクト: brainscales/mozaik
    def post_plot(self):
        if self.title != None:
            pylab.title(self.title, fontsize=self.fontsize)

        if self.x_lim:
            pylab.xlim(self.x_lim)
        if self.y_lim:
            pylab.ylim(self.y_lim)

        if self.x_scale:
            pylab.xscale(self.x_scale)
            if self.x_scale_base:
                pylab.xscale(self.x_scale, basex=self.x_scale_base)

        if self.y_scale:
            pylab.yscale(self.y_scale)
            if self.y_scale_base:
                pylab.yscale(self.y_scale, basey=self.y_scale_base)

        if not self.x_axis:
            phf.disable_xticks(self.axis)
            phf.remove_x_tick_labels()
        if not self.y_axis:
            phf.disable_yticks(self.axis)
            phf.remove_y_tick_labels()

        self._ticks()

        if self.y_label and self.y_axis:
            pylab.ylabel(self.y_label,
                         multialignment='center',
                         fontsize=self.fontsize)
        if self.x_label and self.x_axis:
            pylab.xlabel(self.x_label,
                         multialignment='center',
                         fontsize=self.fontsize)
        if not self.top_right_border:
            phf.disable_top_right_axis(self.axis)
        if not self.left_border:
            phf.disable_left_axis(self.axis)
        if not self.bottom_border:
            phf.disable_bottom_axis(self.axis)

        pylab.rc('axes', linewidth=1)
        pylab.rcParams['xtick.major.pad'] = self.xtick_pad_backup
        pylab.rcParams['ytick.major.pad'] = self.ytick_pad_backup
コード例 #5
0
ファイル: simple_plot.py プロジェクト: apdavison/mozaik
    def _ticks(self):
        if self.x_axis:
            if self.x_ticks != None and self.x_tick_style == "Custom":
                if self.x_tick_labels != None:
                    assert len(self.x_ticks) == len(self.x_tick_labels)
                    pylab.xticks(self.x_ticks, self.x_tick_labels)
                else:
                    pylab.xticks(self.x_ticks)
                    phf.remove_x_tick_labels()
            elif self.x_ticks != None:
                pylab.xticks(self.x_ticks)
                phf.short_tick_labels_axis(self.axis.xaxis)
            else:
                if self.x_tick_style == "Min":
                    phf.three_tick_axis(self.axis.xaxis, log=(self.x_scale != "linear"))
                elif self.x_tick_style == "Custom":
                    phf.disable_xticks(self.axis)
                    phf.remove_x_tick_labels()
                else:
                    raise ValueError("Unknown x tick style %s", self.x_tick_style)

        if self.y_axis:
            if self.y_ticks != None and self.y_tick_style == "Custom":
                if self.y_tick_labels != None:
                    assert len(self.y_ticks) == len(self.y_tick_labels)
                    pylab.yticks(self.y_ticks, self.y_tick_labels)
                else:
                    pylab.yticks(self.y_ticks)
                    phf.remove_y_tick_labels()
            elif self.y_ticks != None:
                pylab.yticks(self.y_ticks)
                phf.short_tick_labels_axis(self.axis.yaxis)
            else:
                if self.y_tick_style == "Min":
                    phf.three_tick_axis(self.axis.yaxis, log=(self.y_scale != "linear"))
                elif self.y_tick_style == "Custom":
                    phf.disable_yticks(self.axis)
                    phf.remove_y_tick_labels()
                else:
                    raise ValueError("Unknow y tick style %s", self.y_tick_style)

        for label in self.axis.get_xticklabels() + self.axis.get_yticklabels():
            label.set_fontsize(self.fontsize)