本文整理汇总了Python中matplotlib.axes.Axes.cla方法的典型用法代码示例。如果您正苦于以下问题:Python Axes.cla方法的具体用法?Python Axes.cla怎么用?Python Axes.cla使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.axes.Axes
的用法示例。
在下文中一共展示了Axes.cla方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Override to set up some reasonable defaults.
"""
# Don't forget to call the base class
Axes.cla(self)
# Set up a default grid spacing
self.set_theta_grid(np.pi/4.)
self.set_phi_grid(np.pi/2.)
self.set_phi_grid_ends(np.pi/8.)
# Turn off minor ticking altogether
self.xaxis.set_minor_locator(NullLocator())
self.yaxis.set_minor_locator(NullLocator())
# Do not display ticks
self.xaxis.set_ticks_position('none')
self.yaxis.set_ticks_position('none')
# The limits on this projection are fixed -- they are not to
# be changed by the user. This makes the math in the
# transformation itself easier, and since this is a toy
# example, the easier, the better.
Axes.set_xlim(self, 0, np.pi)
Axes.set_ylim(self, 0, 2 * np.pi)
示例2: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Override to set up some reasonable defaults.
"""
# Don't forget to call the base class
Axes.cla(self)
# Set up a default grid spacing
self.set_longitude_grid(30)
self.set_latitude_grid(15)
self.set_longitude_grid_ends(75)
# Turn off minor ticking altogether
self.xaxis.set_minor_locator(NullLocator())
self.yaxis.set_minor_locator(NullLocator())
# Do not display ticks -- we only want gridlines and text
self.xaxis.set_ticks_position("none")
self.yaxis.set_ticks_position("none")
# The limits on this projection are fixed -- they are not to
# be changed by the user. This makes the math in the
# transformation itself easier, and since this is a toy
# example, the easier, the better.
Axes.set_xlim(self, -np.pi, np.pi)
Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
示例3: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
# Disconnect the various events we set.
for cid in self.cids:
self.figure.canvas.mpl_disconnect(cid)
self.cids = []
Axes.cla(self)
self.grid(rcParams['axes3d.grid'])
示例4: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Override to set up some reasonable defaults.
"""
# Don't forget to call the base class
Axes.cla(self)
# Turn off minor ticking altogether
self.xaxis.set_minor_locator(NullLocator())
self.yaxis.set_minor_locator(NullLocator())
self.xaxis.set_major_locator(MaxNLocator(5, prune='both'))
self.yaxis.set_major_locator(MaxNLocator(5, prune='both'))
# Do not display ticks -- we only want gridlines and text
self.xaxis.set_ticks_position('none')
self.yaxis.set_ticks_position('none')
self.set_center(None, None)
# FIXME: probabaly want to override autoscale_view
# to properly handle wrapping introduced by margin
# and properlty wrap data.
# It doesn't make sense to have xwidth > 360.
self._tight = True
示例5: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""Provide reasonable defaults for the axes.
"""
# Call the base class.
Axes.cla(self)
self.grid(True)
# Only the x-axis is shown, but there are 3 axes once all of the
# projections are included.
self.yaxis.set_visible(False)
# Adjust the number of ticks shown.
#self.set_xticks(np.linspace(0, self.viewLim.x1, 5))
self.set_xticks(np.linspace(0, self.total, 5))
# Turn off minor ticking altogether.
self.xaxis.set_minor_locator(NullLocator())
# Place the title a little higher than normal.
self.title.set_y(1.02)
# Modify the padding between the tick labels and the axis labels.
self.xaxis.labelpad = 10 # In display units
# Spacing from the vertices (tips) to the tip labels (in data coords, as
# a fraction of self.total)
self.tipoffset = 0.14
示例6: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def 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, -self.horizon, 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([])
示例7: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Override to set up some reasonable defaults.
"""
Axes.cla(self)
self.xaxis.set_minor_locator(NullLocator())
self.yaxis.set_minor_locator(NullLocator())
self.xaxis.set_major_locator(NullLocator())
self.yaxis.set_major_locator(NullLocator())
示例8: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
# Don't forget to call the base class
Axes.cla(self)
self._fancy_majorarcs = []
self._normbox = None
self._scale = self._get_key("axes.scale")
self._current_zorder = self._get_key("plot.zorder")
self.xaxis.set_major_locator(self.RealMaxNLocator(self, self._get_key("grid.major.xmaxn")))
self.yaxis.set_major_locator(self.ImagMaxNLocator(self, self._get_key("grid.major.ymaxn")))
self.xaxis.set_ticks_position('none')
self.yaxis.set_ticks_position('none')
Axes.set_xlim(self, 0, self._ax_lim_x * self._scale)
Axes.set_ylim(self, -self._ax_lim_y * self._scale, self._ax_lim_y * self._scale)
for label in self.get_xticklabels():
label.set_verticalalignment('center')
label.set_horizontalalignment('center')
label.set_rotation(self._get_key("axes.xlabel.rotation"))
label.set_bbox(self._get_key("axes.xlabel.fancybox"))
self.add_artist(label) # if not readded, labels are drawn behind grid
for tick, loc in zip(self.yaxis.get_major_ticks(),
self.yaxis.get_majorticklocs()):
# workaround for fixing to small infinity symbol
if abs(loc) > self._near_inf * self._scale:
tick.label.set_size(tick.label.get_size() +
self._get_key("symbol.infinity.correction"))
tick.label.set_verticalalignment('center')
x = np.real(self._moebius_z(loc * 1j))
if x < -0.1:
tick.label.set_horizontalalignment('right')
elif x > 0.1:
tick.label.set_horizontalalignment('left')
else:
tick.label.set_horizontalalignment('center')
self.yaxis.set_major_formatter(self.ImagFormatter(self))
self.xaxis.set_major_formatter(self.RealFormatter(self))
norm = self._get_key("axes.norm")
if norm is not None:
x, y = split_complex(self._moebius_inv_z(-1 - 1j))
self._normbox = self.text(x, y, "Norm: %d\u2126" % norm)
self._normbox.set_verticalalignment("center")
px = self._get_key("ytick.major.pad")
py = px + 0.5 * self._normbox.get_size()
self._normbox.set_transform(self._yaxis_correction + \
Affine2D().translate(-px, -py))
self.grid(b=self._get_key("grid.major.enable"))
示例9: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Override to set up sensible defaults
"""
Axes.cla(self)
self.set_longitude_grid(45)
self.set_latitude_grid(20)
self.set_xlim([-180, 180])
self.set_ylim([-90, 90])
# Do not display ticks -- we only want gridlines and text
self.xaxis.set_ticks_position('none')
self.yaxis.set_ticks_position('none')
示例10: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
Axes.cla(self)
self.title.set_y(1.05)
self.xaxis.set_major_formatter(self.ThetaFormatter())
angles = np.arange(0.0, 360.0, 45.0)
self.set_thetagrids(angles)
self.yaxis.set_major_locator(self.RadialLocator(self.yaxis.get_major_locator()))
self.grid(rcParams["polaraxes.grid"])
self.xaxis.set_ticks_position("none")
self.yaxis.set_ticks_position("none")
self.yaxis.set_tick_params(label1On=True)
示例11: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
"""
Initialize the Axes object to reasonable defaults.
"""
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.grid(rcParams['axes.grid'])
Axes.set_xlim(self, -npy.pi, npy.pi)
Axes.set_ylim(self, -npy.pi / 2.0, npy.pi / 2.0)
示例12: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [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)
示例13: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
Axes.cla(self)
self.title.set_y(1.05)
# Format radians as degrees
self.xaxis.set_major_formatter(self.ThetaFormatter())
# Nice theta spacing...
self.set_thetagrids(npy.arange(0.0, 360.0, 45.0))
# Axis line for the r axis
self.yaxis.set_major_locator(self.RadialLocator(self.yaxis.get_major_locator()))
# Grid lines
self.grid(rcParams['polaraxes.grid'])
# remove x & y ticks
self.xaxis.set_ticks_position('none')
self.yaxis.set_ticks_position('none')
示例14: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
Axes.cla(self)
self.set_longitude_grid(30)
self.set_latitude_grid(10)
self.set_longitude_grid_ends(89)
self.set_latitude_grid_ends(89)
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, -180, 179.999)
# Axes.set_ylim(self, -90, 90)
Axes.set_ylim(self, -80, 80)
示例15: cla
# 需要导入模块: from matplotlib.axes import Axes [as 别名]
# 或者: from matplotlib.axes.Axes import cla [as 别名]
def cla(self):
Axes.cla(self)
self.title.set_y(1.05)
self.xaxis.set_major_formatter(self.ThetaFormatter())
self.xaxis.isDefault_majfmt = True
angles = np.arange(0.0, 360.0, 45.0)
self.set_thetagrids(angles)
self.yaxis.set_major_locator(self.RadialLocator(self.yaxis.get_major_locator()))
self.grid(rcParams['polaraxes.grid'])
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.set_theta_offset(0)
self.set_theta_direction(1)