當前位置: 首頁>>代碼示例>>Python>>正文


Python ticker.NullLocator方法代碼示例

本文整理匯總了Python中matplotlib.ticker.NullLocator方法的典型用法代碼示例。如果您正苦於以下問題:Python ticker.NullLocator方法的具體用法?Python ticker.NullLocator怎麽用?Python ticker.NullLocator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.ticker的用法示例。


在下文中一共展示了ticker.NullLocator方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _remove_labels_from_axis

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [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 NullLocator [as 別名]
def cla(self):
        Axes.cla(self)

        self.set_longitude_grid(30)
        self.set_latitude_grid(15)
        self.set_longitude_grid_ends(75)
        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.yaxis.set_tick_params(label1On=True)
        # Why do we need to turn on yaxis tick labels, but
        # xaxis tick labels are already on?

        self.grid(rcParams['axes.grid'])

        Axes.set_xlim(self, -np.pi, np.pi)
        Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:geo.py

示例3: show_output

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def show_output(output, img):
    fig, ax = plt.subplots(1)
    ax.imshow(img)

    for obj in output:
        box = obj['box']
        x1, y1, x2, y2 = box[0], box[1], box[2], box[3]
        box_w = x2 - x1
        box_h = y2 - y1
        bbox = patches.Rectangle((x1, y1), box_w, box_h,
                                 linewidth=2, edgecolor='red', facecolor="none")
        ax.add_patch(bbox)
        plt.text(
            x1,
            y1,
            s=obj['name'],
            color="white",
            verticalalignment="top",
            bbox={"color": 'red', "pad": 0},
        )

    plt.axis("off")
    plt.gca().xaxis.set_major_locator(NullLocator())
    plt.gca().yaxis.set_major_locator(NullLocator())
    plt.show() 
開發者ID:rikenmehta03,項目名稱:imsearch,代碼行數:27,代碼來源:yolo_detector.py

示例4: plot_activation

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def plot_activation(matrix, step, save_to=None):
    save_to = os.path.join(".", "activations") if save_to is None else save_to
    os.makedirs(save_to, exist_ok=True)
    if len(matrix.shape) != 2:
        raise ValueError('Input "matrix" should have 2 rank, but it is',str(len(matrix.shape)))
    num_label = matrix.shape[1] - 1
    matrix = matrix[matrix[:, num_label].argsort()]
    fig, axes = plt.subplots(ncols=1, nrows=num_label, figsize=(15,12))
    fig.suptitle("The probability of entity presence (step %s)"%str(step), fontsize=20)
    fig.tight_layout()
    for i, ax in enumerate(axes.flatten()):
        idx = num_label - (i + 1)
        ax.spines['top'].set_color('none')
        ax.spines['bottom'].set_color('none')
        ax.set_ylim(0, 1.05)
        ax.set_ylabel("Capsule " + str(idx))
        ax.yaxis.set_major_locator(ticker.NullLocator())
        if idx > 0:
            ax.xaxis.set_major_locator(ticker.NullLocator())
        else:
            ax.xaxis.set_major_locator(ticker.IndexLocator(base=500,offset=0))
            ax.set_xlabel("Sample index ")
        ax.plot(matrix[:,idx])
        ax_prime = ax.twinx()
        ax_prime.spines['top'].set_color('none')
        ax_prime.spines['bottom'].set_color('none')
    plt.subplots_adjust(hspace=0.2, left=0.05, right=0.95, bottom=0.05, top=.95)
    plt.savefig(os.path.join(save_to, "activation_%s.png" % str(step)))
    plt.close() 
開發者ID:naturomics,項目名稱:CapsLayer,代碼行數:31,代碼來源:figure.py

示例5: cla

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [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

示例6: minorticks_off

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def minorticks_off(self):
        """
        Turns off the minor ticks on the colorbar.
        """
        ax = self.ax
        long_axis = ax.yaxis if self.orientation == 'vertical' else ax.xaxis

        long_axis.set_minor_locator(ticker.NullLocator()) 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:10,代碼來源:colorbar.py

示例7: minorticks_off

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def minorticks_off(self):
        """Remove minor ticks from the axes."""
        self.xaxis.set_minor_locator(mticker.NullLocator())
        self.yaxis.set_minor_locator(mticker.NullLocator())

    # Interactive manipulation 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:8,代碼來源:_base.py

示例8: cla

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [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

示例9: minorticks_off

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def minorticks_off(self):
        """Remove minor ticks from the axes."""
        self.xaxis.set_minor_locator(mticker.NullLocator())
        self.yaxis.set_minor_locator(mticker.NullLocator())

    #### Interactive manipulation 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:8,代碼來源:_base.py

示例10: minorticks_off

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def minorticks_off(self):
        """
        Turns off the minor ticks on the colorbar.
        """
        ax = self.ax
        long_axis = ax.yaxis if self.orientation == 'vertical' else ax.xaxis

        if long_axis.get_scale() == 'log':
            warnings.warn('minorticks_off() has no effect on a '
                          'logarithmic colorbar axis')
        else:
            long_axis.set_minor_locator(ticker.NullLocator()) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:14,代碼來源:colorbar.py

示例11: setup

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def setup(ax):
    ax.spines['right'].set_color('none')
    ax.spines['left'].set_color('none')
    ax.yaxis.set_major_locator(ticker.NullLocator())
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.tick_params(which='major', width=1.00, length=5)
    ax.tick_params(which='minor', width=0.75, length=2.5, labelsize=10)
    ax.set_xlim(0, 5)
    ax.set_ylim(0, 1)
    ax.patch.set_alpha(0.0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:13,代碼來源:tick-formatters.py

示例12: setup

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import NullLocator [as 別名]
def setup(ax):
    ax.spines['right'].set_color('none')
    ax.spines['left'].set_color('none')
    ax.yaxis.set_major_locator(ticker.NullLocator())
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.tick_params(which='major', width=1.00)
    ax.tick_params(which='major', length=5)
    ax.tick_params(which='minor', width=0.75)
    ax.tick_params(which='minor', length=2.5)
    ax.set_xlim(0, 5)
    ax.set_ylim(0, 1)
    ax.patch.set_alpha(0.0) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:15,代碼來源:tick-locators.py


注:本文中的matplotlib.ticker.NullLocator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。