• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python lines.Line2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib.lines.Line2D的典型用法代码示例。如果您正苦于以下问题:Python Line2D类的具体用法?Python Line2D怎么用?Python Line2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

 def __init__(self, ticksize=5., tick_out=False, **kwargs):
     self.set_ticksize(ticksize)
     self.set_tick_out(tick_out)
     self.clear()
     Line2D.__init__(self, [0.], [0.], **kwargs)
     self.set_color('black')
     self.set_visible_axes('all')
开发者ID:ChrisBeaumont,项目名称:wcsaxes,代码行数:7,代码来源:ticks.py


示例2: draw

	def draw(self, renderer):
		x, y = self.get_data()

		if len(x) == 2 or len(y) == 2:
			xlim = self.axes.get_xlim()
			ylim = self.axes.get_ylim()

			x0, y0 = x[0], y[0]
			x1, y1 = x[1], y[1]

			if x0 == x1:	# vertical
				x, y = (x0, x0), ylim
			elif y0 == y1:	# horizontal
				x, y = xlim, (y0, y0)
			else:
				# coeff != 0
				coeff = float(y1 - y0) / (x1 - x0)

				minx = (ylim[0] - y0) / coeff + x0
				maxx = (ylim[1] - y0) / coeff + x0
				miny = coeff * (xlim[0] - x0) + y0
				maxy = coeff * (xlim[1] - x0) + y0

				if coeff > 0:
					x = max(minx, xlim[0]), min(maxx, xlim[1])
					y = max(miny, ylim[0]), min(maxy, ylim[1])
				else:
					x = max(maxx, xlim[0]), min(minx, xlim[1])
					y = min(miny, ylim[1]), max(maxy, ylim[0])


			self.set_data(x, y)

		Line2D.draw(self, renderer)
开发者ID:luipir,项目名称:ps-speed,代码行数:34,代码来源:plot_wdg.py


示例3: draw

    def draw(self, renderer):
        """Draw the line and arrowhead using the passed renderer.
        """
        # if self._invalid:
        #     self.recache()
        renderer.open_group('arrowline2d')
        if not self._visible:
            return

        Line2D.draw(self, renderer)

        if self._arrow is not None:
            gc = renderer.new_gc()
            self._set_gc_clip(gc)
            gc.set_foreground(self._arrowedgecolor)
            gc.set_linewidth(self._arrowedgewidth)
            gc.set_alpha(self._alpha)
            funcname = self.arrows.get(self._arrow, '_draw_nothing')
        if funcname != '_draw_nothing':
            tpath, affine = self._transformed_path\
                                .get_transformed_points_and_affine()
            arrow_func = getattr(self, funcname)
            arrow_func(renderer, gc, tpath, affine.frozen())

        renderer.close_group('arrowline2d')
开发者ID:acquatella,项目名称:ModelicaRes,代码行数:25,代码来源:util.py


示例4: __init__

 def __init__(self, ticksize=None, tick_out=False, **kwargs):
     if ticksize is None:
         ticksize = rcParams["xtick.major.size"]
     self.set_ticksize(ticksize)
     self.set_tick_out(tick_out)
     # FIXME: tick_out is incompatible with Matplotlib tickdir option
     self.clear()
     line2d_kwargs = {"color": rcParams["xtick.color"], "linewidth": rcParams["xtick.major.width"]}
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.0], [0.0], **line2d_kwargs)
     self.set_visible_axes("all")
     self._display_minor_ticks = False
开发者ID:mherkazandjian,项目名称:glue,代码行数:12,代码来源:ticks.py


示例5: __init__

    def __init__(self, *args, **kwargs):
        """Initialize the line and arrow.

        See the top-level class documentation.
        """
        self._arrow = kwargs.pop('arrow', '-')
        self._arrowsize = kwargs.pop('arrowsize', 2 * 4)
        self._arrowedgecolor = kwargs.pop('arrowedgecolor', 'b')
        self._arrowfacecolor = kwargs.pop('arrowfacecolor', 'b')
        self._arrowedgewidth = kwargs.pop('arrowedgewidth', 4)
        self._arrowheadwidth = kwargs.pop('arrowheadwidth', self._arrowsize)
        self._arrowheadlength = kwargs.pop('arrowheadlength', self._arrowsize)
        Line2D.__init__(self, *args, **kwargs)
开发者ID:acquatella,项目名称:ModelicaRes,代码行数:13,代码来源:util.py


示例6: __init__

 def __init__(self, ticksize=None, tick_out=None, **kwargs):
     if ticksize is None:
         ticksize = rcParams['xtick.major.size']
     self.set_ticksize(ticksize)
     self.set_minor_ticksize(rcParams['xtick.minor.size'])
     self.set_tick_out(rcParams['xtick.direction'] == 'out')
     self.clear()
     line2d_kwargs = {'color': rcParams['xtick.color'],
                      'linewidth': rcParams['xtick.major.width']}
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.], [0.], **line2d_kwargs)
     self.set_visible_axes('all')
     self._display_minor_ticks = False
开发者ID:Cadair,项目名称:astropy,代码行数:13,代码来源:ticks.py


示例7: __init__

 def __init__(self, ticksize=None, tick_out=False, **kwargs):
     if ticksize is None:
         ticksize = rcParams['xtick.major.size']
     self.set_ticksize(ticksize)
     self.set_tick_out(tick_out)
     # FIXME: tick_out is incompatible with Matplotlib tickdir option
     self.clear()
     line2d_kwargs = {
         'color': rcParams['xtick.color'],
         'linewidth': rcParams['xtick.major.width']
     }
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.], [0.], **line2d_kwargs)
     self.set_visible_axes('all')
开发者ID:cdeil,项目名称:wcsaxes,代码行数:14,代码来源:ticks.py


示例8: __init__

 def __init__(self, ticksize=None, tick_out=None, **kwargs):
     if ticksize is None:
         ticksize = rcParams['xtick.major.size']
     self.set_ticksize(ticksize)
     self.set_tick_out(rcParams.get('xtick.direction', 'in') == 'out')
     self.clear()
     line2d_kwargs = {'color': rcParams['xtick.color'],
                      # For the linewidth we need to set a default since old versions of
                      # matplotlib don't have this.
                      'linewidth': rcParams.get('xtick.major.width', 1)}
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.], [0.], **line2d_kwargs)
     self.set_visible_axes('all')
     self._display_minor_ticks = False
开发者ID:Juanlu001,项目名称:astropy,代码行数:14,代码来源:ticks.py


示例9: __init__

 def __init__(self, ticksize=None, tick_out=None, **kwargs):
     if ticksize is None:
         ticksize = rcParams["xtick.major.size"]
     self.set_ticksize(ticksize)
     self.set_tick_out(rcParams.get("xtick.direction", "in") == "out")
     self.clear()
     line2d_kwargs = {
         "color": rcParams["xtick.color"],
         # For the linewidth we need to set a default since old versions of
         # matplotlib don't have this.
         "linewidth": rcParams.get("xtick.major.width", 1),
     }
     line2d_kwargs.update(kwargs)
     Line2D.__init__(self, [0.0], [0.0], **line2d_kwargs)
     self.set_visible_axes("all")
     self._display_minor_ticks = False
开发者ID:saimn,项目名称:glue,代码行数:16,代码来源:ticks.py


示例10: __init__

 def __init__(self, xfield = None, yfield = None, canvas = None, *args, **kwargs):
     self.canvas = canvas
     self.original_xfield = xfield
     self.original_yfield = yfield
     self.current_xfield = xfield
     self.current_yfield = yfield
     self.press = None
     self.draggable = False
     self.color = "b"
     self.marker = "None"
     self.xscale = 1.0
     self.yscale = 1.0
     self.xoffset = 0
     self.yoffset = 0
     Line2D.__init__(self, 
                     self.current_xfield.to_list(), 
                     self.current_yfield.to_list(),
                     *args,**kwargs)
开发者ID:nathanial,项目名称:curveeditor,代码行数:18,代码来源:plots.py


示例11: __init__

 def __init__(self, path, *args, **kwargs):
     Line2D.__init__(self, [], [], *args, **kwargs)
     self._path = path
     self._invalid = False
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:4,代码来源:axis_artist.py


示例12: __init__

	def __init__(self, *args, **kwargs):
		Line2D.__init__(self, *args, **kwargs)
开发者ID:luipir,项目名称:ps-speed,代码行数:2,代码来源:plot_wdg.py


示例13: __init__

 def __init__(self, **attrs):
     styles = {'color': '0.5', 'linestyle': '-', 'linewidth': 1}
     styles.update(attrs)
     Line2D.__init__(self, [], [], **styles)
开发者ID:roytest001,项目名称:PythonCode,代码行数:4,代码来源:risto.py


示例14: set_data

 def set_data(self, *args, **kwargs):
     Line2D.set_data(self, *args, **kwargs)
     if self._invalid:
         self.recache()
     self.xorig = np.array(self._x)
     self.yorig = np.array(self._y)
开发者ID:emayssat,项目名称:sandbox,代码行数:6,代码来源:clippedline.py


示例15: __init__

 def __init__(self, ax, *args, **kwargs):
     Line2D.__init__(self, *args, **kwargs)
     self.ax = ax
开发者ID:emayssat,项目名称:sandbox,代码行数:3,代码来源:clippedline.py


示例16: __init__

 def __init__(self, path, *kl, **kw):
     Line2D.__init__(self, [], [], *kl, **kw)
     self._path = path
     self._invalid = False
开发者ID:dopplershift,项目名称:matplotlib,代码行数:4,代码来源:axis_artist.py


示例17: set_data

 def set_data(self, *args, **kwargs):
     Line2D.set_data(self, *args, **kwargs)
     self.xorig = npy.array(self._x)
     self.yorig = npy.array(self._y)
开发者ID:cliburn,项目名称:flow,代码行数:4,代码来源:clippedline.py


示例18: __init__

        
=======
    def __init__(self, ticksize=None, tick_out=False, **kwargs):
        if ticksize is None:
            ticksize = rcParams['xtick.major.size']
>>>>>>> upstream/master
        self.set_ticksize(ticksize)
        self.set_tick_out(tick_out)
        # FIXME: tick_out is incompatible with Matplotlib tickdir option
        self.clear()
        line2d_kwargs = {
            'color': rcParams['xtick.color'],
            'linewidth': rcParams['xtick.major.width']
        }
        line2d_kwargs.update(kwargs)
        Line2D.__init__(self, [0.], [0.], **line2d_kwargs)
        self.set_visible_axes('all')

    def set_tick_out(self, tick_out):
        
        """
        set True if tick need to be rotated by 180 degree.
        """
        self._tick_out = tick_out

    def get_tick_out(self):
        
        """
        Return True if the tick will be rotated by 180 degree.
        """
        return self._tick_out
开发者ID:Sathaye,项目名称:wcsaxes,代码行数:30,代码来源:ticks.py


示例19: set_color

 def set_color(self, color):
     self.color = color
     ret = Line2D.set_color(self, color)
     if self.canvas: self.canvas.draw()
     return ret
开发者ID:nathanial,项目名称:curveeditor,代码行数:5,代码来源:plots.py


示例20: set_marker

 def set_marker(self, marker):
     self.marker = marker
     ret = Line2D.set_marker(self, marker)
     if self.canvas: self.canvas.draw()
     return ret
开发者ID:nathanial,项目名称:curveeditor,代码行数:5,代码来源:plots.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python markers.MarkerStyle类代码示例发布时间:2022-05-27
下一篇:
Python image.NonUniformImage类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap