本文整理匯總了Python中matplotlib.spines方法的典型用法代碼示例。如果您正苦於以下問題:Python matplotlib.spines方法的具體用法?Python matplotlib.spines怎麽用?Python matplotlib.spines使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib
的用法示例。
在下文中一共展示了matplotlib.spines方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_xaxis_transform
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def get_xaxis_transform(self, which='grid'):
"""
Get the transformation used for drawing x-axis labels, ticks
and gridlines. The x-direction is in data coordinates and the
y-direction is in axis coordinates.
.. note::
This transformation is primarily used by the
:class:`~matplotlib.axis.Axis` class, and is meant to be
overridden by new kinds of projections that may need to
place axis elements in different locations.
"""
if which == 'grid':
return self._xaxis_transform
elif which == 'tick1':
# for cartesian projection, this is bottom spine
return self.spines['bottom'].get_spine_transform()
elif which == 'tick2':
# for cartesian projection, this is top spine
return self.spines['top'].get_spine_transform()
else:
raise ValueError('unknown value for which')
示例2: get_yaxis_transform
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def get_yaxis_transform(self, which='grid'):
"""
Get the transformation used for drawing y-axis labels, ticks
and gridlines. The x-direction is in axis coordinates and the
y-direction is in data coordinates.
.. note::
This transformation is primarily used by the
:class:`~matplotlib.axis.Axis` class, and is meant to be
overridden by new kinds of projections that may need to
place axis elements in different locations.
"""
if which == 'grid':
return self._yaxis_transform
elif which == 'tick1':
# for cartesian projection, this is bottom spine
return self.spines['left'].get_spine_transform()
elif which == 'tick2':
# for cartesian projection, this is top spine
return self.spines['right'].get_spine_transform()
else:
raise ValueError('unknown value for which')
示例3: get_children
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def get_children(self):
"""return a list of child artists"""
children = []
children.extend(self.collections)
children.extend(self.patches)
children.extend(self.lines)
children.extend(self.texts)
children.extend(self.artists)
children.extend(self.spines.values())
children.append(self.xaxis)
children.append(self.yaxis)
children.append(self.title)
children.append(self._left_title)
children.append(self._right_title)
children.extend(self.tables)
children.extend(self.images)
children.extend(self.child_axes)
if self.legend_ is not None:
children.append(self.legend_)
children.append(self.patch)
return children
示例4: adjust_spines
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def adjust_spines(ax,spines):
for loc, spine in ax.spines.items():
if loc in spines:
spine.set_position(('outward',10)) # outward by 10 points
else:
spine.set_color('none') # don't draw spine
# turn off ticks where there is no spine
if 'left' in spines:
ax.yaxis.set_ticks_position('left')
else:
# no yaxis ticks
ax.yaxis.set_ticks([])
if 'bottom' in spines:
ax.xaxis.set_ticks_position('bottom')
else:
# no xaxis ticks
ax.xaxis.set_ticks([])
示例5: get_children
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def get_children(self):
"""return a list of child artists"""
children = []
children.extend(self.collections)
children.extend(self.patches)
children.extend(self.lines)
children.extend(self.texts)
children.extend(self.artists)
children.extend(six.itervalues(self.spines))
children.append(self.xaxis)
children.append(self.yaxis)
children.append(self.title)
children.append(self._left_title)
children.append(self._right_title)
children.extend(self.tables)
children.extend(self.images)
if self.legend_ is not None:
children.append(self.legend_)
children.append(self.patch)
return children
示例6: _init_axis
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _init_axis(self):
self.xaxis = maxis.XAxis(self)
self.yaxis = maxis.YAxis(self)
# Do not register xaxis or yaxis with spines -- as done in
# Axes._init_axis() -- until GeoAxes.xaxis.cla() works.
# self.spines['geo'].register_axis(self.yaxis)
self._update_transScale()
示例7: _init_axis
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _init_axis(self):
"move this out of __init__ because non-separable axes don't use it"
self.xaxis = maxis.XAxis(self)
self.yaxis = maxis.YAxis(self)
# Calling polar_axes.xaxis.cla() or polar_axes.xaxis.cla()
# results in weird artifacts. Therefore we disable this for
# now.
# self.spines['polar'].register_axis(self.yaxis)
self._update_transScale()
示例8: _init_axis
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _init_axis(self):
"move this out of __init__ because non-separable axes don't use it"
self.xaxis = maxis.XAxis(self)
self.spines['bottom'].register_axis(self.xaxis)
self.spines['top'].register_axis(self.xaxis)
self.yaxis = maxis.YAxis(self)
self.spines['left'].register_axis(self.yaxis)
self.spines['right'].register_axis(self.yaxis)
self._update_transScale()
示例9: _adjust_location
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _adjust_location(self):
pts = self._path.vertices
if self.spine_type == 'top':
pts[:, 0] = self.axes.upper_xlim
else:
pts[:, 0] = self.axes.lower_xlim
# This class handles registration of the skew-xaxes as a projection as well
# as setting up the appropriate transformations. It also overrides standard
# spines and axes instances as appropriate.
示例10: _init_axis
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _init_axis(self):
# Taken from Axes and modified to use our modified X-axis
self.xaxis = SkewXAxis(self)
self.spines['top'].register_axis(self.xaxis)
self.spines['bottom'].register_axis(self.xaxis)
self.yaxis = maxis.YAxis(self)
self.spines['left'].register_axis(self.yaxis)
self.spines['right'].register_axis(self.yaxis)
示例11: _gen_axes_spines
# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import spines [as 別名]
def _gen_axes_spines(self):
spines = {'top': SkewSpine.linear_spine(self, 'top'),
'bottom': mspines.Spine.linear_spine(self, 'bottom'),
'left': mspines.Spine.linear_spine(self, 'left'),
'right': mspines.Spine.linear_spine(self, 'right')}
return spines