当前位置: 首页>>代码示例>>Python>>正文


Python ticker.NullFormatter方法代码示例

本文整理汇总了Python中matplotlib.ticker.NullFormatter方法的典型用法代码示例。如果您正苦于以下问题:Python ticker.NullFormatter方法的具体用法?Python ticker.NullFormatter怎么用?Python ticker.NullFormatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.ticker的用法示例。


在下文中一共展示了ticker.NullFormatter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _remove_labels_from_axis

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:19,代码来源:_tools.py

示例2: cla

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def cla(self):
        'clear the current axis'
        self.set_major_locator(mticker.AutoLocator())
        self.set_major_formatter(mticker.ScalarFormatter())
        self.set_minor_locator(mticker.NullLocator())
        self.set_minor_formatter(mticker.NullFormatter())

        self.set_label_text('')
        self._set_artist_props(self.label)

        # Keep track of setting to the default value, this allows use to know
        # if any of the following values is explicitly set by the user, so as
        # to not overwrite their settings with any of our 'auto' settings.
        self.isDefault_majloc = True
        self.isDefault_minloc = True
        self.isDefault_majfmt = True
        self.isDefault_minfmt = True
        self.isDefault_label = True

        # Clear the callback registry for this axis, or it may "leak"
        self.callbacks = cbook.CallbackRegistry()

        # whether the grids are on
        self._gridOnMajor = rcParams['axes.grid']
        self._gridOnMinor = False

        self.label.set_text('')
        self._set_artist_props(self.label)

        self.reset_ticks()

        self.converter = None
        self.units = None
        self.set_units(None) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:36,代码来源:axis.py

示例3: cla

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def cla(self):
        GeoAxes.cla(self)
        self.yaxis.set_major_formatter(NullFormatter()) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:geo.py

示例4: remove_text

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def remove_text(figure):
        figure.suptitle("")
        for ax in figure.get_axes():
            ax.set_title("")
            ax.xaxis.set_major_formatter(ticker.NullFormatter())
            ax.xaxis.set_minor_formatter(ticker.NullFormatter())
            ax.yaxis.set_major_formatter(ticker.NullFormatter())
            ax.yaxis.set_minor_formatter(ticker.NullFormatter()) 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:10,代码来源:decorators.py

示例5: init_scatter_hist

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def init_scatter_hist(x_limit, y_limit):
    """
    :return: ax_histx, ax_histy, ax_scatter
    """

    left, width = 0.1, 0.65
    bottom, height = 0.1, 0.65
    bottom_h = bottom + height + 0.02
    left_h = left + width + 0.02

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

    ax_histx = plt.axes(rect_histx)
    ax_histy = plt.axes(rect_histy)
    ax_scatter = plt.axes(rect_scatter)

    nullfmt = NullFormatter()
    ax_histx.xaxis.set_major_formatter(nullfmt)
    ax_histy.yaxis.set_major_formatter(nullfmt)

    ax_scatter.set_xlim(x_limit)
    ax_scatter.set_ylim(y_limit)
    ax_histx.set_xlim(x_limit)
    ax_histy.set_ylim(y_limit)

    return ax_histx, ax_histy, ax_scatter 
开发者ID:xfgryujk,项目名称:TaobaoAnalysis,代码行数:30,代码来源:draw_plot.py

示例6: cla

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def cla(self):
        'clear the current axis'
        self.set_major_locator(mticker.AutoLocator())
        self.set_major_formatter(mticker.ScalarFormatter())
        self.set_minor_locator(mticker.NullLocator())
        self.set_minor_formatter(mticker.NullFormatter())

        self.set_label_text('')
        self._set_artist_props(self.label)

        # Keep track of setting to the default value, this allows use to know
        # if any of the following values is explicitly set by the user, so as
        # to not overwrite their settings with any of our 'auto' settings.
        self.isDefault_majloc = True
        self.isDefault_minloc = True
        self.isDefault_majfmt = True
        self.isDefault_minfmt = True
        self.isDefault_label = True

        # Clear the callback registry for this axis, or it may "leak"
        self.callbacks = cbook.CallbackRegistry()

        # whether the grids are on
        self._gridOnMajor = rcParams['axes.grid'] and (rcParams['axes.grid.which'] in ('both','major'))
        self._gridOnMinor = rcParams['axes.grid'] and (rcParams['axes.grid.which'] in ('both','minor'))

        self.label.set_text('')
        self._set_artist_props(self.label)

        self.reset_ticks()

        self.converter = None
        self.units = None
        self.set_units(None) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:36,代码来源:axis.py

示例7: remove_text

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def remove_text(figure):
        figure.suptitle("")
        for ax in figure.get_axes():
            ax.set_title("")
            ax.xaxis.set_major_formatter(ticker.NullFormatter())
            ax.xaxis.set_minor_formatter(ticker.NullFormatter())
            ax.yaxis.set_major_formatter(ticker.NullFormatter())
            ax.yaxis.set_minor_formatter(ticker.NullFormatter())
            try:
                ax.zaxis.set_major_formatter(ticker.NullFormatter())
                ax.zaxis.set_minor_formatter(ticker.NullFormatter())
            except AttributeError:
                pass 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:15,代码来源:decorators.py

示例8: remove_ticks_and_titles

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def remove_ticks_and_titles(figure):
    figure.suptitle("")
    null_formatter = ticker.NullFormatter()
    for ax in figure.get_axes():
        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 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:16,代码来源:decorators.py

示例9: draw_example_graph

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def draw_example_graph(dataset, trial_path):
    results = []
    with open(trial_path + "/rotation_single_x.csv") as file:
        reader = csv.reader(file)
        for row in reader:
            result = [float(r) for r in row]  # ex [0, 45, 90, 135, 180, 225, 270, 315]
            results.append([*result[len(result) // 2:], *result[:len(result) // 2 + 1]])

    major_tick = MultipleLocator(18)
    major_formatter = FixedFormatter(["", "-180", "-90", "0", "+90", "+180"])
    minor_tick = MultipleLocator(9)

    x = np.arange(len(results[0]))

    # Draw figure
    for j in range(0, min(len(results), 5)):
        if "bace" in trial_path or "hiv" in trial_path:
            plt.figure(figsize=(8, 2.5))
            ax = plt.subplot(1, 1, 1)
            ax.spines['right'].set_visible(False)
            ax.spines['top'].set_visible(False)

            plt.plot(x, results[j], color="#000000", linewidth=2)

            # Left ticks
            ax.xaxis.set_major_locator(major_tick)
            ax.xaxis.set_major_formatter(major_formatter)
            ax.xaxis.set_minor_locator(minor_tick)
            ax.xaxis.set_minor_formatter(NullFormatter())
            plt.ylim(0, 1)
            plt.yticks(np.arange(0, 1.01, 0.5), ("0.0", "0.5", "1.0"))

            fig_name = "../../experiment/figure/ex/rotation_single_{}_{}_x.png".format(dataset, j)
            plt.savefig(fig_name, dpi=600)
            plt.clf()
            print("Saved figure on {}".format(fig_name))

        else:
            # Figure
            plt.figure(figsize=(8, 2.5))
            ax = plt.subplot(1, 1, 1)
            ax.spines['right'].set_visible(False)
            ax.spines['top'].set_visible(False)

            y = results[j]
            mean_y = np.average(y)
            ylim = (mean_y - 1.5, mean_y + 1.5)
            plt.plot(x, y, color="#000000", linewidth=2)

            # Ticks
            ax.xaxis.set_major_locator(major_tick)
            ax.xaxis.set_major_formatter(major_formatter)
            ax.xaxis.set_minor_locator(minor_tick)
            ax.xaxis.set_minor_formatter(NullFormatter())
            plt.ylim(ylim)

            fig_name = "../../experiment/figure/ex/rotation_single_{}_{}_x.png".format(dataset, j)
            plt.savefig(fig_name, dpi=600)
            plt.clf()
            print("Saved figure on {}".format(fig_name)) 
开发者ID:blackmints,项目名称:3DGCN,代码行数:62,代码来源:rotational_invariance.py

示例10: _check_ticks_props

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
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:
                        tm.assert_almost_equal(label.get_fontsize(),
                                               xlabelsize)
                    if xrot is not None:
                        tm.assert_almost_equal(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:
                        tm.assert_almost_equal(label.get_fontsize(),
                                               ylabelsize)
                    if yrot is not None:
                        tm.assert_almost_equal(label.get_rotation(), yrot) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:51,代码来源:common.py

示例11: visualize

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import NullFormatter [as 别名]
def visualize(args):
  num_layers, layer_id = None, 0
  while True:
    # extract X, labels <= create tsne input
    X, y = [], []
    id2lab, lab2id = {}, {}
    with open(args.feat_file, 'r') as f:
      for line in f:
        info = json.loads(line.strip())
        span_start = np.array(info['start_layer'][layer_id], dtype=np.float32)
        span_end = np.array(info['end_layer'][layer_id], dtype=np.float32)
        label = info['label']
        if label not in lab2id:
          lab2id[label] = len(lab2id)
          id2lab[lab2id[label]] = label
        y.append(lab2id[label])
        X.append(np.concatenate((span_start, span_end, np.multiply(span_start, span_end), span_start-span_end)))
        if not num_layers:
          num_layers = len(info['end_layer'])
    X = np.array(X, dtype=np.float32)
    y = np.array(y, dtype=np.int)
    layer_id += 1

    # perform t-SNE
    embeddings = TSNE(n_components=2, init='pca', verbose=0, perplexity=30, n_iter=500).fit_transform(X)
    xx = embeddings[:, 0]
    yy = embeddings[:, 1]

    # plot
    fig = plt.figure()
    ax = fig.add_subplot(111)
    num_classes = len(lab2id)
    colors = cm.Spectral(np.linspace(0, 1, num_classes))
    labels = np.arange(num_classes)
    for i in range(num_classes):
      ax.scatter(xx[y==i], yy[y==i], color=colors[i], label=id2lab[i], s=12)
    ax.xaxis.set_major_formatter(NullFormatter())
    ax.yaxis.set_major_formatter(NullFormatter())
    plt.axis('tight')
    box = ax.get_position()
    ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
    ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
    plt.savefig(args.output_file_prefix + str(layer_id) +".pdf", format='pdf', dpi=600)
    #plt.show()
    print('layer %d plot => %s'%(layer_id, args.output_file_prefix + str(layer_id) +".pdf"))
    
    if layer_id == num_layers:
      break 
开发者ID:ganeshjawahar,项目名称:interpret_bert,代码行数:50,代码来源:visualize.py


注:本文中的matplotlib.ticker.NullFormatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。