Python matplotlib.ticker 模块,NullFormatter() 实例源码

我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用matplotlib.ticker.NullFormatter()

项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def _remove_labels_from_axis(axis):
    for t in axis.get_majorticklabels():
        t.set_visible(False)

    try:
        # set_visible will not be effective if
        # minor axis has NullLocator and NullFormattor (default)
        import matplotlib.ticker as ticker
        if isinstance(axis.get_minor_locator(), ticker.NullLocator):
            axis.set_minor_locator(ticker.AutoLocator())
        if isinstance(axis.get_minor_formatter(), ticker.NullFormatter):
            axis.set_minor_formatter(ticker.FormatStrFormatter(''))
        for t in axis.get_minorticklabels():
            t.set_visible(False)
    except Exception:   # pragma no cover
        raise
    axis.get_label().set_visible(False)
项目:yellowbrick    作者:DistrictDataLabs    | 项目源码 | 文件源码
def remove_ticks_and_titles(ax):
    """Removes tickets and formatting on sub ax object that is useful for the
    assert_images_similar as different OS having varying font styles and other
    system level differences
    """
    null_formatter = ticker.NullFormatter()
    ax.set_title("")
    ax.xaxis.set_major_formatter(null_formatter)
    ax.xaxis.set_minor_formatter(null_formatter)
    ax.yaxis.set_major_formatter(null_formatter)
    ax.yaxis.set_minor_formatter(null_formatter)
    try:
        ax.zaxis.set_major_formatter(null_formatter)
        ax.zaxis.set_minor_formatter(null_formatter)
    except AttributeError:
        pass
项目:artemis    作者:QUVA-Lab    | 项目源码 | 文件源码
def set_default_locators_and_formatters(self, axis):
        """
        Just took the code from LinearScale.set_default_locators_and_formatters
        """
        axis.set_major_locator(AutoLocator())
        axis.set_major_formatter(ScalarFormatter())
        axis.set_minor_locator(NullLocator())
        axis.set_minor_formatter(NullFormatter())
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def setLineSensor(self):
        try:
            self.compressLabel(self.sensorList)

            x1=[]
            x1pos=[]
            labels1=[]

            j = -1
            x1pos.append(0)
            labels1.append('')
           # self.setTestData()
            for i in self.sensorList:
                if i.startX > j:
                    x1.append(i.startX)
                    j = i.startX
                    x1.append(i.stopX)
                    x1pos.append(i.labelPos)
                    labels1.append(i.label)


            self.par1.xaxis.set_major_formatter(ticker.NullFormatter())
            self.par1.xaxis.set_minor_locator(ticker.FixedLocator(x1pos))
            self.par1.xaxis.set_minor_formatter(ticker.FixedFormatter(labels1))
            self.par1.xaxis.set_ticks(x1)

        except Exception as _err:
            print(_err)
            logging.exception(_err)
            pass
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def setLineRBW(self):

        self.compressLabel(self.rbwList)

        try:
            x1 = []
            x1pos = []
            labels1 = []
            j = -1
            x1pos.append(0)
            labels1.append('')
           # self.setTestData()
            for i in self.rbwList:
                if i.startX > j:
                    x1.append(i.startX)
                    j = i.startX
                x1.append(i.stopX)
                x1pos.append(i.labelPos)
                labels1.append(i.label)

         #   self.par2.spines["bottom"].set_position(("outward", 50))
         #   self.par2.xaxis.set_ticks_position('bottom')
#            self.par2.set_xscale('log')
            self.par2.xaxis.set_major_formatter(ticker.NullFormatter())
            self.par2.xaxis.set_minor_locator(ticker.FixedLocator(x1pos))
            self.par2.xaxis.set_minor_formatter(ticker.FixedFormatter(labels1))
            self.par2.xaxis.set_ticks(x1)
            self.par2.xaxis.set_tick_params(which='minor',length=1,direction='out', pad=5, labelbottom='on')
            self.par2.xaxis.set_tick_params(which='major',length=10,direction='out', pad=5,labelbottom='on')

        except Exception as _err:
            print(_err)
            logging.exception(_err)
项目:lotss-catalogue    作者:mhardcastle    | 项目源码 | 文件源码
def make_ax3():
    paper_single(TW=8, AR=0.9)
    f = plt.figure()

    from matplotlib.ticker import NullFormatter, MaxNLocator

    nullfmt   = NullFormatter()         # no labels

    # definitions for the axes
    left, width = 0.1, 0.65
    bottom, height = 0.1, 0.6
    bottom_h = bottom+height+0.02
    left_h = left+width+0.02

    rect_scatter = [left, bottom, width, height]
    rect_histx = [left, bottom_h, width, 0.2]
    rect_histy = [left_h, bottom, 0.2, height]

    ax = plt.axes(rect_scatter)
    plt.minorticks_on()
    axx = plt.axes(rect_histx)
    plt.minorticks_on()
    axy = plt.axes(rect_histy)
    plt.minorticks_on()

    # no labels
    axx.xaxis.set_major_formatter(nullfmt)
    axy.yaxis.set_major_formatter(nullfmt)


    axy.xaxis.set_major_locator(MaxNLocator(3))
    axx.yaxis.set_major_locator(MaxNLocator(3))

    return f,ax,axx,axy
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def _plot_zcontinuous(self):
        if self.parts is None:
            parts = [np.ones_like(self.xdata, dtype=bool)]
        else:
            parts = self.parts

        good = np.sum(parts, axis=0, dtype=bool)
        good *= np.isfinite(self.xdata)
        good *= np.isfinite(self.ydata)
        good *= np.isfinite(self.zdata)  # TODO: Sem essa linha, onde não houver perfil z será plotado de ?preto? 

        zticks = self.zlocator(np.min(self.zdata[good]), np.max(self.zdata[good]))
        self.zlim = [zticks[0], zticks[-1]]
        self.zticks = zticks[1:-1]

        norm = Normalize(*self.zlim)

        for part in parts:
            x = self.xdata[part*good]
            y = self.ydata[part*good]
            c = self.zdata[part*good]
            collection = self.crossplot_ax.scatter(x, y, c=c, cmap=self.cmap, norm=norm, zorder=-len(x), **self.collectionproperties)
            self.collections.append(collection)

        xticks = self.xlocator(np.min(self.xdata[good]), np.max(self.xdata[good]))
        self.set_xlim([xticks[0], xticks[-1]])

        yticks = self.ylocator(np.min(self.ydata[good]), np.max(self.ydata[good]))
        self.set_ylim([yticks[0], yticks[-1]])

        self.colorbar = ColorbarBase(self.colorbar_ax, cmap=self.cmap, norm=norm, ticks=self.zticks)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def set_default_locators_and_formatters(self, axis):
        axis.set_major_locator(NullLocator())
        axis.set_major_formatter(NullFormatter())
        axis.set_minor_formatter(NullFormatter())
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def _plot_zcontinuous(self):
        if self.parts is None:
            parts = [np.ones_like(self.xdata, dtype=bool)]
        else:
            parts = self.parts

        good = np.sum(parts, axis=0, dtype=bool)
        good *= np.isfinite(self.xdata)
        good *= np.isfinite(self.ydata)
        if self.zdata is not None:
            good *= np.isfinite(self.zdata)  # TODO: Sem essa linha, onde não houver perfil z será plotado de ?preto? 

        zticks = self.zlocator(np.min(self.zdata[good]), np.max(self.zdata[good]))
        self.zlim = [zticks[0], zticks[-1]]
        self.zticks = zticks[1:-1]

        norm = Normalize(*self.zlim)
        #
        for part in parts:
            x = self.xdata[part*good]
            y = self.ydata[part*good]
            c = self.zdata[part*good]
            collection = self.crossplot_ax.scatter(x, y, c=c, cmap=self.cmap, 
                                                   norm=norm, zorder=-len(x), 
                                                   **self.collectionproperties
            )
            self.collections.append(collection)
        #    
        xticks = self.xlocator(np.min(self.xdata[good]), np.max(self.xdata[good]))
        self.set_xlim([xticks[0], xticks[-1]])

        yticks = self.ylocator(np.min(self.ydata[good]), np.max(self.ydata[good]))
        self.set_ylim([yticks[0], yticks[-1]])

        self.colorbar = ColorbarBase(self.colorbar_ax, cmap=self.cmap, 
                                     norm=norm, ticks=self.zticks
        )
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())
项目:sparselab    作者:eht-jp    | 项目源码 | 文件源码
def mfista_plots(fdfin, ptable, filename=None,
                 plotargs={'ms': 1., }):
    isinteractive = plt.isinteractive()
    backend = matplotlib.rcParams["backend"]

    if isinteractive:
        plt.ioff()
        matplotlib.use('Agg')

    nullfmt = NullFormatter()

    # Get model data
    modelptable = ptable.copy()
    modelptable.observe(fdfin)

    # Save fdf
    if filename is not None:
        util.matplotlibrc(nrows=4, ncols=2, width=400, height=150)
    else:
        matplotlib.rcdefaults()

    fig, axs = plt.subplots(nrows=4, ncols=2, sharex=False)
    fdfin.plot(axs=axs[:,0],color="red")
    ptable.plot(axs=axs[:,1],color="black", ploterror=True)
    modelptable.plot(axs=axs[:,1], color="red")
    if filename is not None:
        plt.savefig(filename)
        plt.close()
    else:
        plt.show()

    if isinteractive:
        plt.ion()
        matplotlib.use(backend)
项目:Deep-Learning-Plugin    作者:flowjo-lakes    | 项目源码 | 文件源码
def scatterHist(x1,x2, y1,y2, axis1='', axis2=''):
    nullfmt = NullFormatter()         # no labels

    # definitions for the axes
    left, width = 0.1, 0.65
    bottom, height = 0.1, 0.65
    bottom_h = left_h = left + width + 0.02

    rect_scatter = [left, bottom, width, height]
    rect_histx = [left, bottom_h, width, 0.2]
    rect_histy = [left_h, bottom, 0.2, height]

    # start with a rectangular Figure
    plt.figure(figsize=(8, 8))

    axScatter = plt.axes(rect_scatter)
    axHistx = plt.axes(rect_histx)
    axHisty = plt.axes(rect_histy)

    # no labels
    axHistx.xaxis.set_major_formatter(nullfmt)
    axHisty.yaxis.set_major_formatter(nullfmt)

    # the scatter plot:
    axScatter.scatter(x1, x2, color = 'blue', s=3)
    axScatter.scatter(y1, y2, color = 'red', s=3) 


    # now determine nice limits by hand:
    binwidth = 0.5
    xymax = np.max([np.max(np.fabs(x1)), np.max(np.fabs(x2))])
    lim = (int(xymax/binwidth) + 1) * binwidth

    axScatter.set_xlim((-lim, lim))
    axScatter.set_ylim((-lim, lim))

    bins = np.arange(-lim, lim + binwidth, binwidth)
    axHistx.hist(x1, bins=bins, color = 'blue', normed=True, stacked = True, histtype='step' )
    axHisty.hist(x2, bins=bins, orientation='horizontal', color = 'blue', normed=True, stacked = True, histtype='step')
    axHistx.hist(y1, bins=bins, color = 'red', normed=True, stacked = True, histtype='step')
    axHisty.hist(y2, bins=bins, orientation='horizontal', color = 'red', normed=True, stacked = True, histtype='step')

    axHistx.set_xlim(axScatter.get_xlim())
    axHisty.set_ylim(axScatter.get_ylim())

    axHistx.set_xticklabels([])
    axHistx.set_yticklabels([])
    axHisty.set_xticklabels([])
    axHisty.set_yticklabels([])
    axScatter.set_xlabel(axis1, fontsize=15)
    axScatter.set_ylabel(axis2, fontsize=15)


    plt.show()
项目:lddmm-ot    作者:jeanfeydy    | 项目源码 | 文件源码
def get_axis_properties(axis):
    """Return the property dictionary for a matplotlib.Axis instance"""
    props = {}
    label1On = axis._major_tick_kw.get('label1On', True)

    if isinstance(axis, matplotlib.axis.XAxis):
        if label1On:
            props['position'] = "bottom"
        else:
            props['position'] = "top"
    elif isinstance(axis, matplotlib.axis.YAxis):
        if label1On:
            props['position'] = "left"
        else:
            props['position'] = "right"
    else:
        raise ValueError("{0} should be an Axis instance".format(axis))

    # Use tick values if appropriate
    locator = axis.get_major_locator()
    props['nticks'] = len(locator())
    if isinstance(locator, ticker.FixedLocator):
        props['tickvalues'] = list(locator())
    else:
        props['tickvalues'] = None

    # Find tick formats
    formatter = axis.get_major_formatter()
    if isinstance(formatter, ticker.NullFormatter):
        props['tickformat'] = ""
    elif not any(label.get_visible() for label in axis.get_ticklabels()):
        props['tickformat'] = ""
    else:
        props['tickformat'] = None

    # Get axis scale
    props['scale'] = axis.get_scale()

    # Get major tick label size (assumes that's all we really care about!)
    labels = axis.get_ticklabels()
    if labels:
        props['fontsize'] = labels[0].get_fontsize()
    else:
        props['fontsize'] = None

    # Get associated grid
    props['grid'] = get_grid_style(axis)

    return props
项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def _check_ticks_props(self, axes, xlabelsize=None, xrot=None,
                           ylabelsize=None, yrot=None):
        """
        Check each axes has expected tick properties

        Parameters
        ----------
        axes : matplotlib Axes object, or its list-like
        xlabelsize : number
            expected xticks font size
        xrot : number
            expected xticks rotation
        ylabelsize : number
            expected yticks font size
        yrot : number
            expected yticks rotation
        """
        from matplotlib.ticker import NullFormatter
        axes = self._flatten_visible(axes)
        for ax in axes:
            if xlabelsize or xrot:
                if isinstance(ax.xaxis.get_minor_formatter(), NullFormatter):
                    # If minor ticks has NullFormatter, rot / fontsize are not
                    # retained
                    labels = ax.get_xticklabels()
                else:
                    labels = ax.get_xticklabels() + ax.get_xticklabels(
                        minor=True)

                for label in labels:
                    if xlabelsize is not None:
                        self.assertAlmostEqual(label.get_fontsize(),
                                               xlabelsize)
                    if xrot is not None:
                        self.assertAlmostEqual(label.get_rotation(), xrot)

            if ylabelsize or yrot:
                if isinstance(ax.yaxis.get_minor_formatter(), NullFormatter):
                    labels = ax.get_yticklabels()
                else:
                    labels = ax.get_yticklabels() + ax.get_yticklabels(
                        minor=True)

                for label in labels:
                    if ylabelsize is not None:
                        self.assertAlmostEqual(label.get_fontsize(),
                                               ylabelsize)
                    if yrot is not None:
                        self.assertAlmostEqual(label.get_rotation(), yrot)
项目:BatchEffectRemoval    作者:ushaham    | 项目源码 | 文件源码
def scatterHist(x1,x2, y1,y2, axis1='', axis2=''):
    nullfmt = NullFormatter()         # no labels

    # definitions for the axes
    left, width = 0.1, 0.65
    bottom, height = 0.1, 0.65
    bottom_h = left_h = left + width + 0.02

    rect_scatter = [left, bottom, width, height]
    rect_histx = [left, bottom_h, width, 0.2]
    rect_histy = [left_h, bottom, 0.2, height]

    # start with a rectangular Figure
    plt.figure(figsize=(8, 8))

    axScatter = plt.axes(rect_scatter)
    axHistx = plt.axes(rect_histx)
    axHisty = plt.axes(rect_histy)

    # no labels
    axHistx.xaxis.set_major_formatter(nullfmt)
    axHisty.yaxis.set_major_formatter(nullfmt)

    # the scatter plot:
    axScatter.scatter(x1, x2, color = 'blue', s=3)
    axScatter.scatter(y1, y2, color = 'red', s=3) 


    # now determine nice limits by hand:
    binwidth = 0.5
    xymax = np.max([np.max(np.fabs(x1)), np.max(np.fabs(x2))])
    lim = (int(xymax/binwidth) + 1) * binwidth

    axScatter.set_xlim((-lim, lim))
    axScatter.set_ylim((-lim, lim))

    bins = np.arange(-lim, lim + binwidth, binwidth)
    axHistx.hist(x1, bins=bins, color = 'blue', normed=True, stacked = True, histtype='step' )
    axHisty.hist(x2, bins=bins, orientation='horizontal', color = 'blue', normed=True, stacked = True, histtype='step')
    axHistx.hist(y1, bins=bins, color = 'red', normed=True, stacked = True, histtype='step')
    axHisty.hist(y2, bins=bins, orientation='horizontal', color = 'red', normed=True, stacked = True, histtype='step')

    axHistx.set_xlim(axScatter.get_xlim())
    axHisty.set_ylim(axScatter.get_ylim())

    axHistx.set_xticklabels([])
    axHistx.set_yticklabels([])
    axHisty.set_xticklabels([])
    axHisty.set_yticklabels([])
    axScatter.set_xlabel(axis1, fontsize=15)
    axScatter.set_ylabel(axis2, fontsize=15)


    plt.show()
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def setLineAMP(self):

        self.compressLabel(self.ampList)

        try:
            x1 = []
            x1pos = []
            labels1 = []
            j = -1
            x1pos.append(0)
            labels1.append('')
           # self.setTestData()
            for i in self.ampList:
                if i.startX > j:
                    x1.append(i.startX)
                    j = i.startX
                x1.append(i.stopX)
                x1pos.append(i.labelPos)
                labels1.append(i.label)


            if not self.line2TextFlag:
                # self.par3.text(-0.05,-0.33,"amp",horizontalalignment='left',transform=self.host.transAxes)
                # self.par3.text(-0.05,-0.40,"att",horizontalalignment='left',transform=self.host.transAxes)
               #  self.par3.spines["bottom"].set_position(("outward", 90))
                 self.par3.xaxis.set_ticks_position('bottom')
                 self.par3.xaxis.set_major_formatter(ticker.NullFormatter())
                 self.par3.xaxis.set_minor_formatter(ticker.NullFormatter())
                 self.par3.xaxis.set_tick_params(which='minor',length=1,direction='in', pad=-10, labelbottom='on')
                 self.par3.xaxis.set_tick_params(which='major',length=10,direction='in', pad=-20,labelbottom='on')
                 self.line2TextFlag = True

            self.par3.xaxis.set_minor_locator(ticker.FixedLocator(x1pos))
            self.par3.xaxis.set_minor_formatter(ticker.FixedFormatter(labels1))
            self.par3.xaxis.set_ticks(x1)

            #set color for autorange indication
            _Ret = self.par3.xaxis.get_minorticklabels()
            n = 0
            for i in _Ret:
                if self.ampList[n].color =='r':
                    i._color = 'r' #sorry, found no other access
                if n < len(self.ampList) - 1:
                    n += 1
        except Exception as _err:
            print(_err)
            logging.exception(_err)
        pass
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def setLineATT(self):

        self.compressLabel(self.attList)

        try:
            x1 = []
            x1pos = []
            labels1 = []
            j = -1
            x1pos.append(0)
            labels1.append('')
           # self.setTestData()
            for i in self.attList:
                if i.startX > j:
                    x1.append(i.startX)
                    j = i.startX
                x1.append(i.stopX)
                x1pos.append(i.labelPos)
                labels1.append(i.label)


       #     self.par4.spines["bottom"].set_position(("outward", 90))
       #     self.par4.xaxis.set_ticks_position('bottom')
           # # self.par1.set_xlim(1e3,1e9)
           #  self.par4.set_xscale('log')
            self.par4.xaxis.set_major_formatter(ticker.NullFormatter())
            self.par4.xaxis.set_minor_locator(ticker.FixedLocator(x1pos))
            self.par4.xaxis.set_minor_formatter(ticker.FixedFormatter(labels1))
            self.par4.xaxis.set_ticks(x1)
            self.par4.xaxis.set_tick_params(which='minor',length=1,direction='out', pad=5, labelbottom='on')
            self.par4.xaxis.set_tick_params(which='major',length=10,direction='out', pad=5,labelbottom='on')

            _Ret = self.par4.xaxis.get_minorticklabels()
            n = 0
            for i in _Ret:
                if self.attList[n].color =='r':
                    i._color = 'red'
                if n < len(self.attList) - 1:
                    n += 1

          #  self.signalGraphUpdate.emit()
        except Exception as _err:
            print(_err)
            logging.exception(_err)
        pass
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def onNewPlot(self, data):
     #   print ('Graph: new Plot')
        assert isinstance(data,DB_Handler_TPL3.Tpl3Plot)
        self.host.set_xlim(data.x1,data.x2)
        self.host.set_ylim(data.y1,data.y2)
        self.par1.set_xlim(data.x1,data.x2)
        self.par2.set_xlim(data.x1,data.x2)
        self.par3.set_xlim(data.x1,data.x2)
        self.par4.set_xlim(data.x1,data.x2)
        self.par1.set_xscale('log')
        self.par1.xaxis.set_major_formatter(ticker.NullFormatter())
        self.par1.xaxis.set_minor_formatter(ticker.NullFormatter())
        self.par2.set_xscale('log')
        self.par2.xaxis.set_major_formatter(ticker.NullFormatter())
        self.par2.xaxis.set_minor_formatter(ticker.NullFormatter())
        self.par3.set_xscale('log')
        self.par3.xaxis.set_major_formatter(ticker.NullFormatter())
        self.par3.xaxis.set_minor_formatter(ticker.NullFormatter())
        self.par4.set_xscale('log')
        self.par4.xaxis.set_major_formatter(ticker.NullFormatter())
        self.par4.xaxis.set_minor_formatter(ticker.NullFormatter())
        #self.setWindowTitle(data.plot_title)
        self.signalShowTitle.emit(data.plot_title)
        #self.figure_canvas.draw()
        descriptionData = []
        descriptionData.append(data.eut)
        descriptionData.append(data.test_no)
        descriptionData.append(data.serial_no)
        descriptionData.append(data.model_no)
        descriptionData.append(data.model_name)
        descriptionData.append(data.date_time)
        descriptionData.append(data.company)
        descriptionData.append(data.technician)
        descriptionData.append(data.plan_title)
        descriptionData.append(data.routines)
        descriptionData.append(data.plot_no)
        descriptionData.append(data.annotations)
        sList = data.sources.split(',')
        if len(sList) > 0:
            for s in sList:
                descriptionData.append(s)
        self.setText(descriptionData)
        self.signalGraphUpdate.emit()

        self.currentStaticPlotFlag = False
        pass
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CrossPlotPanel, self).__init__(*args, **kwargs)
        self.figure = Figure()
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.cmap = Colors.COLOR_MAP_RAINBOW
        self.colorbar = None
        self.collections = []
        self.xdata = None
        self.ydata = None
        self.zdata = None
        self.xlabel = ''
        self.ylabel = ''
        self.zlabel = ''
        self.xlocator = MaxNLocator(6).tick_values
        self.ylocator = MaxNLocator(6).tick_values
        self.zlocator = MaxNLocator(6).tick_values
        self.xlim = None
        self.ylim = None
        self.zlim = None
        self.zmode = 'continuous'
        self.classnames = {}
        self.classcolors = {}
        self.nullclass = np.nan
        self.parts = None
        self.shownparts = []

        rect = [self.MAINAXLEFT, self.MAINAXBOTTOM, self.MAINAXWIDTH, self.MAINAXHEIGHT]
        self.crossplot_ax = self.figure.add_axes(rect)
        self.crossplot_ax.xaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.xaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.yaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.yaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.grid(axis='x', which='major', linestyle='-.')
        self.crossplot_ax.grid(axis='y', which='major', linestyle='-.')

        self.create_xlabel()
        self.create_ylabel()
        self.create_zlabel()

        rect = [self.COLORBARLEFT, self.MAINAXBOTTOM, self.COLORBARWIDTH, self.MAINAXHEIGHT]
        self.colorbar_ax = self.figure.add_axes(rect, sharey=self.zlabel_ax)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())

        self.collectionproperties = dict(linewidths=0.5, s=30)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.Fit()

        # self.status_bar = self.Parent.StatusBar # TODO: tirar isso quando voltar a status_bar

        self.canvas.mpl_connect('button_press_event', self.on_press)
        self.canvas.mpl_connect('motion_notify_event', self.on_move)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def _plot_zclasses(self):
        if self.parts is None:
            parts = [np.ones_like(self.xdata, dtype=bool)]
        else:
            parts = self.parts

        good = np.sum(parts, axis=0, dtype=bool)
        good *= np.isfinite(self.xdata)
        good *= np.isfinite(self.ydata)
        #good *= np.isfinite(self.zdata)  # TODO: Sem essa linha, onde não houver classificação será plotado de preto 

        classes = np.unique(self.zdata[good])
        self.classes = classes[classes != self.nullclass]

        n = self.zdata.shape[0]
        m = len(self.classes)
        ncc = len(self.classcolors.values()[0])

        zdata = np.full((n, ncc), np.nan)
        for cls in self.classes:
            zdata[self.zdata == cls] = self.classcolors[cls]
        zdata[self.zdata == self.nullclass] = self.nullcolor

        cmap = ListedColormap([self.classcolors[cls] for cls in self.classes])
        cmap.set_bad(self.nullcolor)
        self.zticks = range(m)
        self.zlim = [-0.5, m - 0.5]
        norm = NoNorm(*self.zlim)

        for part in parts:
            x = self.xdata[part*good]
            y = self.ydata[part*good]
            c = zdata[part*good]
            collection = self.crossplot_ax.scatter(x, y, c=c, cmap=cmap, zorder=-len(x), **self.collectionproperties)
            self.collections.append(collection)

        xticks = self.xlocator(np.min(self.xdata[good]), np.max(self.xdata[good]))
        self.set_xlim([xticks[0], xticks[-1]])

        yticks = self.ylocator(np.min(self.ydata[good]), np.max(self.ydata[good]))
        self.set_ylim([yticks[0], yticks[-1]])

        self.colorbar = ColorbarBase(self.colorbar_ax, cmap=cmap, norm=norm, ticks=self.zticks)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CrossPlotPanel, self).__init__(*args, **kwargs)
        self.figure = Figure()
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.cmap = Colors.COLOR_MAP_RAINBOW
        self.colorbar = None
        self.collections = []
        self.xdata = None
        self.ydata = None
        self.zdata = None
        self.xlabel = ''
        self.ylabel = ''
        self.zlabel = ''
        self.xlocator = MaxNLocator(6).tick_values
        self.ylocator = MaxNLocator(6).tick_values
        self.zlocator = MaxNLocator(6).tick_values
        self.xlim = None
        self.ylim = None
        self.zlim = None
        self.zmode = 'continuous'
        self.classnames = {}
        self.classcolors = {}
        self.nullclass = np.nan
        self.parts = None
        self.shownparts = []

        rect = [self.MAINAXLEFT, self.MAINAXBOTTOM, self.MAINAXWIDTH, self.MAINAXHEIGHT]
        self.crossplot_ax = self.figure.add_axes(rect)
        self.crossplot_ax.xaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.xaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.yaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.yaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.grid(axis='x', which='major', linestyle='-.')
        self.crossplot_ax.grid(axis='y', which='major', linestyle='-.')

        self.create_xlabel()
        self.create_ylabel()
        self.create_zlabel()

        rect = [self.COLORBARLEFT, self.MAINAXBOTTOM, self.COLORBARWIDTH, self.MAINAXHEIGHT]
        self.colorbar_ax = self.figure.add_axes(rect, sharey=self.zlabel_ax)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())

        self.collectionproperties = dict(linewidths=0.5, s=30)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.Fit()

        # self.status_bar = self.Parent.StatusBar # TODO: tirar isso quando voltar a status_bar

        self.canvas.mpl_connect('button_press_event', self.on_press)
        self.canvas.mpl_connect('motion_notify_event', self.on_move)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def _plot_zclasses(self):
        if self.parts is None:
            parts = [np.ones_like(self.xdata, dtype=bool)]
        else:
            parts = self.parts

        good = np.sum(parts, axis=0, dtype=bool)
        good *= np.isfinite(self.xdata)
        good *= np.isfinite(self.ydata)
        #good *= np.isfinite(self.zdata)  # TODO: Sem essa linha, onde não houver classificação será plotado de preto 

        classes = np.unique(self.zdata[good])
        self.classes = classes[classes != self.nullclass]

        n = self.zdata.shape[0]
        m = len(self.classes)
        ncc = len(self.classcolors.values()[0])

        zdata = np.full((n, ncc), np.nan)
        for cls in self.classes:
            zdata[self.zdata == cls] = self.classcolors[cls]
        zdata[self.zdata == self.nullclass] = self.nullcolor

        cmap = ListedColormap([self.classcolors[cls] for cls in self.classes])
        cmap.set_bad(self.nullcolor)
        self.zticks = range(m)
        self.zlim = [-0.5, m - 0.5]
        norm = NoNorm(*self.zlim)

        for part in parts:
            x = self.xdata[part*good]
            y = self.ydata[part*good]
            c = zdata[part*good]
            collection = self.crossplot_ax.scatter(x, y, c=c, cmap=cmap, zorder=-len(x), **self.collectionproperties)
            self.collections.append(collection)

        xticks = self.xlocator(np.min(self.xdata[good]), np.max(self.xdata[good]))
        self.set_xlim([xticks[0], xticks[-1]])

        yticks = self.ylocator(np.min(self.ydata[good]), np.max(self.ydata[good]))
        self.set_ylim([yticks[0], yticks[-1]])

        self.colorbar = ColorbarBase(self.colorbar_ax, cmap=cmap, norm=norm, ticks=self.zticks)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())