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


Python transforms.IdentityTransform類代碼示例

本文整理匯總了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()
開發者ID:ddale,項目名稱:matplotlib,代碼行數:8,代碼來源:markers.py

示例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
開發者ID:jahn,項目名稱:matplotlib,代碼行數:10,代碼來源:artist.py

示例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
#.........這裏部分代碼省略.........
開發者ID:EnochManohar,項目名稱:matplotlib,代碼行數:101,代碼來源:markers.py

示例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.
開發者ID:Xarthisius,項目名稱:matplotlib,代碼行數:67,代碼來源:artist.py

示例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
#.........這裏部分代碼省略.........
開發者ID:bicarrio,項目名稱:matplotlib,代碼行數:101,代碼來源:markers.py


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