本文整理汇总了Python中transforms.IdentityTransform类的典型用法代码示例。如果您正苦于以下问题:Python IdentityTransform类的具体用法?Python IdentityTransform怎么用?Python IdentityTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IdentityTransform类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _recache
def _recache(self):
self._path = Path(np.empty((0,2)))
self._transform = IdentityTransform()
self._alt_path = None
self._alt_transform = None
self._snap_threshold = None
self._filled = True
self._marker_function()
示例2: get_transform
def get_transform(self):
"""
Return the :class:`~matplotlib.transforms.Transform`
instance used by this artist.
"""
if self._transform is None:
self._transform = IdentityTransform()
elif not isinstance(self._transform, Transform) and hasattr(self._transform, "_as_mpl_transform"):
self._transform = self._transform._as_mpl_transform(self.axes)
return self._transform
示例3: tuple
class MarkerStyle:
style_table = """
============================== ===============================================
marker description
============================== ===============================================
%s
``'$...$'`` render the string using mathtext
*verts* a list of (x, y) pairs in range (0, 1)
(*numsides*, *style*, *angle*) see below
============================== ===============================================
The marker can also be a tuple (*numsides*, *style*, *angle*), which
will create a custom, regular symbol.
*numsides*:
the number of sides
*style*:
the style of the regular symbol:
===== =============================================
Value Description
===== =============================================
0 a regular polygon
1 a star-like symbol
2 an asterisk
3 a circle (*numsides* and *angle* is ignored)
===== =============================================
*angle*:
the angle of rotation of the symbol
For backward compatibility, the form (*verts*, 0) is also accepted,
but it is equivalent to just *verts* for giving a raw set of vertices
that define the shape.
"""
# TODO: Automatically generate this
accepts = """ACCEPTS: [ %s | ``'$...$'`` | *tuple* | *Nx2 array* ]"""
markers = {
'.' : 'point',
',' : 'pixel',
'o' : 'circle',
'v' : 'triangle_down',
'^' : 'triangle_up',
'<' : 'triangle_left',
'>' : 'triangle_right',
'1' : 'tri_down',
'2' : 'tri_up',
'3' : 'tri_left',
'4' : 'tri_right',
'8' : 'octagon',
's' : 'square',
'p' : 'pentagon',
'*' : 'star',
'h' : 'hexagon1',
'H' : 'hexagon2',
'+' : 'plus',
'x' : 'x',
'D' : 'diamond',
'd' : 'thin_diamond',
'|' : 'vline',
'_' : 'hline',
TICKLEFT : 'tickleft',
TICKRIGHT : 'tickright',
TICKUP : 'tickup',
TICKDOWN : 'tickdown',
CARETLEFT : 'caretleft',
CARETRIGHT : 'caretright',
CARETUP : 'caretup',
CARETDOWN : 'caretdown',
"None" : 'nothing',
None : 'nothing',
' ' : 'nothing',
'' : 'nothing'
}
# Just used for informational purposes. is_filled()
# is calculated in the _set_* functions.
filled_markers = (
'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd')
fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top', 'none')
_half_fillstyles = ('left' , 'right' , 'bottom' , 'top')
# TODO: Is this ever used as a non-constant?
_point_size_reduction = 0.5
def __init__(self, marker=None, fillstyle='full'):
self._fillstyle = fillstyle
self.set_marker(marker)
self.set_fillstyle(fillstyle)
def _recache(self):
self._path = Path(np.empty((0,2)))
self._transform = IdentityTransform()
self._alt_path = None
self._alt_transform = None
self._snap_threshold = None
#.........这里部分代码省略.........
示例4: Artist
#.........这里部分代码省略.........
def pchanged(self):
"""
Fire an event when property changed, calling all of the
registered callbacks.
"""
for oid, func in self._propobservers.iteritems():
func(self)
def is_transform_set(self):
"""
Returns *True* if :class:`Artist` has a transform explicitly
set.
"""
return self._transformSet
def set_transform(self, t):
"""
Set the :class:`~matplotlib.transforms.Transform` instance
used by this artist.
ACCEPTS: :class:`~matplotlib.transforms.Transform` instance
"""
self._transform = t
self._transformSet = t is not None
self.pchanged()
def get_transform(self):
"""
Return the :class:`~matplotlib.transforms.Transform`
instance used by this artist.
"""
if self._transform is None:
self._transform = IdentityTransform()
elif (not isinstance(self._transform, Transform)
and hasattr(self._transform, '_as_mpl_transform')):
self._transform = self._transform._as_mpl_transform(self.axes)
return self._transform
def hitlist(self, event):
"""
List the children of the artist which contain the mouse event *event*.
"""
L = []
try:
hascursor, info = self.contains(event)
if hascursor:
L.append(self)
except:
import traceback
traceback.print_exc()
print("while checking", self.__class__)
for a in self.get_children():
L.extend(a.hitlist(event))
return L
def get_children(self):
"""
Return a list of the child :class:`Artist`s this
:class:`Artist` contains.
"""
return []
def contains(self, mouseevent):
"""Test whether the artist contains the mouse event.
示例5: MarkerStyle
class MarkerStyle(object):
markers = {
".": "point",
",": "pixel",
"o": "circle",
"v": "triangle_down",
"^": "triangle_up",
"<": "triangle_left",
">": "triangle_right",
"1": "tri_down",
"2": "tri_up",
"3": "tri_left",
"4": "tri_right",
"8": "octagon",
"s": "square",
"p": "pentagon",
"*": "star",
"h": "hexagon1",
"H": "hexagon2",
"+": "plus",
"x": "x",
"D": "diamond",
"d": "thin_diamond",
"|": "vline",
"_": "hline",
TICKLEFT: "tickleft",
TICKRIGHT: "tickright",
TICKUP: "tickup",
TICKDOWN: "tickdown",
CARETLEFT: "caretleft",
CARETRIGHT: "caretright",
CARETUP: "caretup",
CARETDOWN: "caretdown",
"None": "nothing",
None: "nothing",
" ": "nothing",
"": "nothing",
}
# Just used for informational purposes. is_filled()
# is calculated in the _set_* functions.
filled_markers = ("o", "v", "^", "<", ">", "8", "s", "p", "*", "h", "H", "D", "d")
fillstyles = ("full", "left", "right", "bottom", "top", "none")
_half_fillstyles = ("left", "right", "bottom", "top")
# TODO: Is this ever used as a non-constant?
_point_size_reduction = 0.5
def __init__(self, marker=None, fillstyle="full"):
"""
MarkerStyle
Attributes
----------
markers : list of known markes
fillstyles : list of known fillstyles
filled_markers : list of known filled markers.
Parameters
----------
marker : string or array_like, optional, default: None
See the descriptions of possible markers in the module docstring.
fillstyle : string, optional, default: 'full'
'full', 'left", 'right', 'bottom', 'top', 'none'
"""
self._fillstyle = fillstyle
self.set_marker(marker)
self.set_fillstyle(fillstyle)
def __getstate__(self):
d = self.__dict__.copy()
d.pop("_marker_function")
return d
def __setstate__(self, statedict):
self.__dict__ = statedict
self.set_marker(self._marker)
self._recache()
def _recache(self):
self._path = Path(np.empty((0, 2)))
self._transform = IdentityTransform()
self._alt_path = None
self._alt_transform = None
self._snap_threshold = None
self._joinstyle = "round"
self._capstyle = "butt"
self._filled = True
self._marker_function()
def __nonzero__(self):
return bool(len(self._path.vertices))
def is_filled(self):
return self._filled
#.........这里部分代码省略.........