当前位置: 首页>>代码示例>>Python>>正文


Python artist.Artist方法代码示例

本文整理汇总了Python中matplotlib.artist.Artist方法的典型用法代码示例。如果您正苦于以下问题:Python artist.Artist方法的具体用法?Python artist.Artist怎么用?Python artist.Artist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.artist的用法示例。


在下文中一共展示了artist.Artist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_zoom

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def get_zoom(self):
        return self._zoom

#     def set_axes(self, axes):
#         self.image.set_axes(axes)
#         martist.Artist.set_axes(self, axes)

#     def set_offset(self, xy):
#         """
#         set offset of the container.

#         Accept : tuple of x,y coordinate in disokay units.
#         """
#         self._offset = xy

#         self.offset_transform.clear()
#         self.offset_transform.translate(xy[0], xy[1]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:offsetbox.py

示例2: draw_bbox

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def draw_bbox(bbox, renderer, color='k', trans=None):
    """
    This is a debug function to draw a rectangle around the bounding
    box returned by
    :meth:`~matplotlib.artist.Artist.get_window_extent` of an artist,
    to test whether the artist is returning the correct bbox.
    """

    l, b, w, h = bbox.bounds
    r = Rectangle(xy=(l, b),
                  width=w,
                  height=h,
                  edgecolor=color,
                  fill=False,
                 )
    if trans is not None:
        r.set_transform(trans)
    r.set_clip_on(False)
    r.draw(renderer) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:21,代码来源:patches.py

示例3: set_alpha

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def set_alpha(self, alpha):
        """
        Set the alpha tranparencies of the collection.  *alpha* must be
        a float or *None*.

        ACCEPTS: float or None
        """
        if alpha is not None:
            try:
                float(alpha)
            except TypeError:
                raise TypeError('alpha must be a float or None')
        artist.Artist.set_alpha(self, alpha)
        try:
            self._facecolors = mcolors.colorConverter.to_rgba_array(
                self._facecolors_original, self._alpha)
        except (AttributeError, TypeError, IndexError):
            pass
        try:
            if self._edgecolors_original != 'face':
                self._edgecolors = mcolors.colorConverter.to_rgba_array(
                    self._edgecolors_original, self._alpha)
        except (AttributeError, TypeError, IndexError):
            pass 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:26,代码来源:collections.py

示例4: update_from

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def update_from(self, other):
        'copy properties from other to self'

        artist.Artist.update_from(self, other)
        self._antialiaseds = other._antialiaseds
        self._edgecolors_original = other._edgecolors_original
        self._edgecolors = other._edgecolors
        self._facecolors_original = other._facecolors_original
        self._facecolors = other._facecolors
        self._linewidths = other._linewidths
        self._linestyles = other._linestyles
        self._pickradius = other._pickradius
        self._hatch = other._hatch

        # update_from for scalarmappable
        self._A = other._A
        self.norm = other.norm
        self.cmap = other.cmap
        # self.update_dict = other.update_dict # do we need to copy this? -JJL


# these are not available for the object inspector until after the
# class is built so we define an initial set here for the init
# function and they will be overridden after object defn 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:26,代码来源:collections.py

示例5: __init__

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def __init__(self, verts, sizes=None, closed=True, **kwargs):
        """
        *verts* is a sequence of ( *verts0*, *verts1*, ...) where
        *verts_i* is a sequence of *xy* tuples of vertices, or an
        equivalent :mod:`numpy` array of shape (*nv*, 2).

        *sizes* is *None* (default) or a sequence of floats that
        scale the corresponding *verts_i*.  The scaling is applied
        before the Artist master transform; if the latter is an identity
        transform, then the overall scaling is such that if
        *verts_i* specify a unit square, then *sizes_i* is the area
        of that square in points^2.
        If len(*sizes*) < *nv*, the additional values will be
        taken cyclically from the array.

        *closed*, when *True*, will explicitly close the polygon.

        %(Collection)s
        """
        Collection.__init__(self, **kwargs)
        self._sizes = sizes
        self.set_verts(verts, closed) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:collections.py

示例6: __init__

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def __init__(self, fig,
                 cmap=None,
                 norm=None,
                 offsetx=0,
                 offsety=0,
                 origin=None,
                 **kwargs
                 ):

        """
        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        kwargs are an optional list of Artist keyword args
        """
        martist.Artist.__init__(self)
        cm.ScalarMappable.__init__(self, norm, cmap)
        if origin is None:
            origin = rcParams['image.origin']
        self.origin = origin
        self.figure = fig
        self.ox = offsetx
        self.oy = offsety
        self.update(kwargs)
        self.magnification = 1.0 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:27,代码来源:image.py

示例7: get_zoom

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def get_zoom(self):
        return self._zoom

#     def set_axes(self, axes):
#         self.image.set_axes(axes)
#         martist.Artist.set_axes(self, axes)

#     def set_offset(self, xy):
#         """
#         Set the offset of the container.
#
#         Parameters
#         ----------
#         xy : (float, float)
#             The (x,y) coordinates of the offset in display units.
#         """
#         self._offset = xy

#         self.offset_transform.clear()
#         self.offset_transform.translate(xy[0], xy[1]) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:22,代码来源:offsetbox.py

示例8: __init__

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def __init__(self, fig,
                 cmap=None,
                 norm=None,
                 offsetx=0,
                 offsety=0,
                 origin=None,
                 **kwargs
                 ):
        """
        cmap is a colors.Colormap instance
        norm is a colors.Normalize instance to map luminance to 0-1

        kwargs are an optional list of Artist keyword args
        """
        super().__init__(
            None,
            norm=norm,
            cmap=cmap,
            origin=origin
        )
        self.figure = fig
        self.ox = offsetx
        self.oy = offsety
        self.update(kwargs)
        self.magnification = 1.0 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:27,代码来源:image.py

示例9: set_figure

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def set_figure(self, fig):
        """
        Set the `.Figure` for this `.Axes`.

        Parameters
        ----------
        fig : `.Figure`
        """
        martist.Artist.set_figure(self, fig)

        self.bbox = mtransforms.TransformedBbox(self._position,
                                                fig.transFigure)
        # these will be updated later as data is added
        self.dataLim = mtransforms.Bbox.null()
        self.viewLim = mtransforms.Bbox.unit()
        self.transScale = mtransforms.TransformWrapper(
            mtransforms.IdentityTransform())

        self._set_lim_and_transforms() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:21,代码来源:_base.py

示例10: add_artist

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def add_artist(self, a):
        """
        Add an `~.Artist` to the axes, and return the artist.

        Use `add_artist` only for artists for which there is no dedicated
        "add" method; and if necessary, use a method such as `update_datalim`
        to manually update the dataLim if the artist is to be included in
        autoscaling.

        If no ``transform`` has been specified when creating the artist (e.g.
        ``artist.get_transform() == None``) then the transform is set to
        ``ax.transData``.
        """
        a.axes = self
        self.artists.append(a)
        a._remove_method = self.artists.remove
        self._set_artist_props(a)
        a.set_clip_path(self.patch)
        self.stale = True
        return a 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:22,代码来源:_base.py

示例11: setTarget

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def setTarget(self, element: Artist):
        """ set the target artist for this widget """
        if isinstance(element, list):
            self.target_list = element
            element = element[0]
        else:
            if element is None:
                self.target_list = []
            else:
                self.target_list = [element]
        self.target = None
        self.font_size.setValue(element.get_fontsize())

        index_selected = self.align_names.index(element.get_ha())
        for index, button in enumerate(self.buttons_align):
            button.setChecked(index == index_selected)

        self.button_bold.setChecked(element.get_weight() == "bold")
        self.button_italic.setChecked(element.get_style() == "italic")
        self.button_color.setColor(element.get_color())

        self.target = element 
开发者ID:rgerum,项目名称:pylustrator,代码行数:24,代码来源:QComplexWidgets.py

示例12: getTransform

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def getTransform(self, element: Artist) -> Optional[mpl.transforms.Transform]:
        """ get the transform of an Artist """
        if isinstance(element, Figure):
            if self.transform_index == 0:
                return transforms.Affine2D().scale(2.54, 2.54)
            return None
        if isinstance(element, Axes):
            if self.transform_index == 0:
                return transforms.Affine2D().scale(2.54,
                                                   2.54) + element.figure.dpi_scale_trans.inverted() + element.figure.transFigure
            if self.transform_index == 1:
                return element.figure.dpi_scale_trans.inverted() + element.figure.transFigure
            if self.transform_index == 2:
                return element.figure.transFigure
            return None
        if self.transform_index == 0:
            return transforms.Affine2D().scale(2.54,
                                               2.54) + element.figure.dpi_scale_trans.inverted() + element.get_transform()
        if self.transform_index == 1:
            return element.figure.dpi_scale_trans.inverted() + element.get_transform()
        if self.transform_index == 2:
            return element.get_transform()
        return None 
开发者ID:rgerum,项目名称:pylustrator,代码行数:25,代码来源:QComplexWidgets.py

示例13: add_target

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def add_target(self, target: Artist):
        """ add an artist to the selection """
        target = TargetWrapper(target)

        new_points = np.array(target.get_positions())
        if len(new_points) == 0:
            return

        self.targets.append(target)

        x0, y0, x1, y1 = np.min(new_points[:, 0]), np.min(new_points[:, 1]), np.max(new_points[:, 0]), np.max(
            new_points[:, 1])
        rect1 = Rectangle((x0, y0), x1 - x0, y1 - y0, picker=False, figure=self.figure, linestyle="-", edgecolor="w",
                          facecolor="#FFFFFF00", zorder=900, label="_rect for %s" % str(target))
        rect2 = Rectangle((x0, y0), x1 - x0, y1 - y0, picker=False, figure=self.figure, linestyle="--", edgecolor="k",
                          facecolor="#FFFFFF00", zorder=900, label="_rect2 for %s" % str(target))
        self.figure.patches.append(rect1)
        self.figure.patches.append(rect2)
        self.targets_rects.append(rect1)
        self.targets_rects.append(rect2)

        self.update_extent() 
开发者ID:rgerum,项目名称:pylustrator,代码行数:24,代码来源:drag_helper.py

示例14: __init__

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def __init__(self, ax, mappable, **kw):
        # Ensure the given mappable's norm has appropriate vmin and vmax set
        # even if mappable.draw has not yet been called.
        mappable.autoscale_None()

        self.mappable = mappable
        kw['cmap'] = cmap = mappable.cmap
        kw['norm'] = norm = mappable.norm

        if isinstance(mappable, contour.ContourSet):
            CS = mappable
            kw['alpha'] = mappable.get_alpha()
            kw['boundaries'] = CS._levels
            kw['values'] = CS.cvalues
            kw['extend'] = CS.extend
            #kw['ticks'] = CS._levels
            kw.setdefault('ticks', ticker.FixedLocator(CS.levels, nbins=10))
            kw['filled'] = CS.filled
            ColorbarBase.__init__(self, ax, **kw)
            if not CS.filled:
                self.add_lines(CS)
        else:
            if getattr(cmap, 'colorbar_extend', False) is not False:
                kw.setdefault('extend', cmap.colorbar_extend)

            if isinstance(mappable, martist.Artist):
                kw['alpha'] = mappable.get_alpha()

            ColorbarBase.__init__(self, ax, **kw) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:31,代码来源:colorbar.py

示例15: set_clip_path

# 需要导入模块: from matplotlib import artist [as 别名]
# 或者: from matplotlib.artist import Artist [as 别名]
def set_clip_path(self, clippath, transform=None):
        artist.Artist.set_clip_path(self, clippath, transform)
        #self.tick1line.set_clip_path(clippath, transform)
        #self.tick2line.set_clip_path(clippath, transform)
        self.gridline.set_clip_path(clippath, transform) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:axis.py


注:本文中的matplotlib.artist.Artist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。