Python matplotlib.ticker.NullLocator() Examples
The following are 30
code examples of matplotlib.ticker.NullLocator().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.ticker
, or try the search function
.
Example #1
Source File: _tools.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: _tools.py From twitter-stock-recommendation with MIT License | 6 votes |
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)
Example #3
Source File: _tools.py From coffeegrindsize with MIT License | 6 votes |
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)
Example #4
Source File: yolo_detector.py From imsearch with Apache License 2.0 | 6 votes |
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()
Example #5
Source File: _tools.py From elasticintel with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: _tools.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
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)
Example #7
Source File: geo.py From ImageFusion with MIT License | 6 votes |
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)
Example #8
Source File: custom_projection.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #9
Source File: geo.py From neural-network-animation with MIT License | 6 votes |
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)
Example #10
Source File: geo.py From matplotlib-4-abaqus with MIT License | 6 votes |
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)
Example #11
Source File: _tools.py From recruit with Apache License 2.0 | 6 votes |
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)
Example #12
Source File: _tools.py From vnpy_crypto with MIT License | 6 votes |
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)
Example #13
Source File: geo.py From Computable with MIT License | 6 votes |
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)
Example #14
Source File: axis.py From neural-network-animation with MIT License | 5 votes |
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)
Example #15
Source File: test_ticker.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_set_params(self): """ Create null locator, and attempt to call set_params() on it. Should not exception, and should raise a warning. """ loc = mticker.NullLocator() with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") loc.set_params() assert len(w) == 1
Example #16
Source File: _base.py From twitter-stock-recommendation with MIT License | 5 votes |
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
Example #17
Source File: _base.py From CogAlg with MIT License | 5 votes |
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
Example #18
Source File: colorbar.py From CogAlg with MIT License | 5 votes |
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())
Example #19
Source File: test_ticker.py From coffeegrindsize with MIT License | 5 votes |
def test_set_params(self): """ Create null locator, and attempt to call set_params() on it. Should not exception, and should raise a warning. """ loc = mticker.NullLocator() with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") loc.set_params() assert len(w) == 1
Example #20
Source File: _base.py From coffeegrindsize with MIT License | 5 votes |
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
Example #21
Source File: colorbar.py From coffeegrindsize with MIT License | 5 votes |
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())
Example #22
Source File: axis.py From Computable with MIT License | 5 votes |
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)
Example #23
Source File: visualizer.py From yolo_nano with MIT License | 5 votes |
def clean_matplot(self): fig, ax = plt.subplots(1) plt.axis('off') plt.gca().xaxis.set_major_locator(NullLocator()) plt.gca().yaxis.set_major_locator(NullLocator()) plt.tight_layout(pad = 0) return fig, ax
Example #24
Source File: colorbar.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
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())
Example #25
Source File: _base.py From ImageFusion with MIT License | 5 votes |
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
Example #26
Source File: axis.py From ImageFusion with MIT License | 5 votes |
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)
Example #27
Source File: reference-tick-locators.py From matplotlib-cheatsheet with BSD 2-Clause "Simplified" License | 5 votes |
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)
Example #28
Source File: reference-tick-formatters.py From matplotlib-cheatsheet with BSD 2-Clause "Simplified" License | 5 votes |
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)
Example #29
Source File: figure.py From CapsLayer with Apache License 2.0 | 5 votes |
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()
Example #30
Source File: _base.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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