微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python matplotlib.ticker 模块-NullLocator() 实例源码

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

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

项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def @H_502_26@_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)
项目:pymake    作者:dtrckd    | 项目源码 | 文件源码
def @H_502_26@scaledimage(W, pixwidth=1, ax=None, grayscale=True):
    """
    Do intensity plot,similar to MATLAB imagesc()

    W = intensity matrix to visualize
    pixwidth = size of each W element
    ax = matplotlib Axes to draw on
    grayscale = use grayscale color map

    Rely on caller to .show()
    """

    # N = rows,M = column
    (N, M) = W.shape
    # Need to create a new Axes?
    if(ax == None):
        ax = plt.figure().gca()
    # extents = Left Right Bottom Top
    exts = (0, pixwidth * M, 0, pixwidth * N)
    if(grayscale):
        ax.imshow(W,
                  interpolation='nearest',
                  cmap=CM.gray,
                  extent=exts)
    else:
        ax.imshow(W,
                  extent=exts)

    ax.xaxis.set_major_locator(MT.NullLocator())
    ax.yaxis.set_major_locator(MT.NullLocator())
    return ax
项目:artemis    作者:QUVA-Lab    | 项目源码 | 文件源码
def @H_502_26@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())
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@create_xlabel(self):
        rect = [self.MAINAXLEFT, self.XLABELBottOM, self.MAINAXWIDTH, self.XLABELHEIGHT]
        self.xlabel_ax = self.figure.add_axes(rect)
        self.xlabel_ax.xaxis.set_major_locator(NullLocator())
        self.xlabel_ax.yaxis.set_major_locator(NullLocator())
        self.xlabel_ax.text(0.5, self.XLABELTEXTBottOM, '', ha='center', va='bottom', fontsize=self.TEXTFONTSIZE)
        self.xlabel_ax.text(self.XLABELTEXTHMARGIN, self.XLABELTEXTTOP, ha='left', va='top', fontsize=self.NUMBERFONTSIZE)
        self.xlabel_ax.text(1.0 - self.XLABELTEXTHMARGIN, ha='right', fontsize=self.NUMBERFONTSIZE)
        self.xlabel_ax.set_xlim(0.0, 1.0)
        self.xlabel_ax.set_ylim(0.0, 1.0)
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@create_ylabel(self):
        rect = [self.YLABELLEFT, self.MAINAXBottOM, self.YLABELWIDTH, self.MAINAXHEIGHT]
        self.ylabel_ax = self.figure.add_axes(rect)
        self.ylabel_ax.xaxis.set_major_locator(NullLocator())
        self.ylabel_ax.yaxis.set_major_locator(NullLocator())
        self.ylabel_ax.text(self.YLABELTEXTLEFT, 0.5, va='center', fontsize=self.TEXTFONTSIZE, rotation=90)
        self.ylabel_ax.text(self.YLABELTEXTRIGHT, self.YLABELTEXTVMARGIN, fontsize=self.NUMBERFONTSIZE)
        self.ylabel_ax.text(self.YLABELTEXTRIGHT, 1.0 - self.YLABELTEXTVMARGIN, fontsize=self.NUMBERFONTSIZE)
        self.ylabel_ax.set_xlim(0.0, 1.0)
        self.ylabel_ax.set_ylim(0.0, 1.0)
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@clear_zlabel(self):
        self.zlabel_ax.clear()
        self.zlabel_ax.xaxis.set_major_locator(NullLocator())
        self.zlabel_ax.yaxis.set_major_locator(NullLocator())
        self.zlabel_ax.text(self.ZLABELTEXTRIGHT, self.zlabel, rotation=270)
        self.zlabel_ax.set_xlim(0.0, 1.0)
        self.zlabel_ax.set_ylim(0.0, 1.0)
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@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 @H_502_26@create_and_prepare_axes(figure, extent):
    #import matplotlib.figure.figure.text
    ax = Axes(figure, extent)
    ax.spines['right'].set_visible(False)
    ax.spines['top'].set_visible(False)
    ax.spines['left'].set_visible(False)
    ax.spines['bottom'].set_visible(False)
    ax.xaxis.set_major_locator(NullLocator())
    ax.yaxis.set_major_locator(NullLocator())
    figure.add_axes(ax)
    return ax
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@create_ylabel(self):
        rect = [self.YLABELLEFT, 1.0)
项目:gripy    作者:giruenf    | 项目源码 | 文件源码
def @H_502_26@clear_zlabel(self):
        self.zlabel_ax.clear()
        self.zlabel_ax.xaxis.set_major_locator(NullLocator())
        self.zlabel_ax.yaxis.set_major_locator(NullLocator())
        self.zlabel_ax.text(self.ZLABELTEXTRIGHT, 1.0)
项目:qgis-stereonet    作者:daniel-childs    | 项目源码 | 文件源码
def @H_502_26@cla(self):
        """Identical to Axes.cla (This docstring is overwritten)."""
        Axes.cla(self)

        # Set grid defaults...
        self.set_longitude_grid(10)
        self.set_latitude_grid(10)
        self.set_longitude_grid_ends(80)

        # Hide all ticks and tick labels for the "native" lon and lat axes
        self.xaxis.set_minor_locator(NullLocator())
        self.yaxis.set_minor_locator(NullLocator())
        self.xaxis.set_ticks_position('none')
        self.yaxis.set_ticks_position('none')
        self.xaxis.set_tick_params(label1On=False)
        self.yaxis.set_tick_params(label1On=False)

        # Set the grid on or off based on the rc params.
        self.grid(mpl.rcParams['axes.grid'])

        # Set the default limits (so that the "native" ticklabels will be
        # correct if they're turned back on)...
        Axes.set_xlim(self, -2 * self.horizon, 2 * self.horizon)
        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)

        # Set up the azimuth ticks.
        self._polar.set_theta_offset(np.radians(self.rotation + 90))
        self._polar.set_theta_direction(-1)
        self._polar.grid(False)
        self._polar.set_rticks([])

    # Use default docstring,as usage is identical.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐