matplotlib.lines.AxLine#

class matplotlib.lines.AxLine(xy1, xy2, slope, **kwargs)[源代码][源代码]#

基类:Line2D

一个辅助类,通过在绘制时重新计算艺术家变换来实现 axline

参数:
xy1(浮点数, 浮点数)

线条要经过的第一组 (x, y) 坐标。

xy2(float, float) 或 None

线的第二组 (x, y) 坐标。xy2slope 都必须传递,但其中之一必须是 None。

斜率浮点数或无

这条线的斜率。xy2slope 都必须传递,但其中之一必须为 None。

draw(renderer)[源代码][源代码]#

使用给定的渲染器绘制艺术家(及其子项)。

如果艺术家不可见(Artist.get_visible 返回 False),则此操作无效。

参数:
渲染器 : RendererBase 子类。RendererBase 子类。

注释

此方法在 Artist 子类中被重写。

get_slope()[源代码][源代码]#

返回直线的 斜率 值。

get_transform()[源代码][源代码]#

返回此艺术家使用的 Transform 实例。

get_xy1()[源代码][源代码]#

返回线的 xy1 值。

get_xy2()[源代码][源代码]#

返回该行的 xy2 值。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, dash_capstyle=<UNSET>, dash_joinstyle=<UNSET>, dashes=<UNSET>, data=<UNSET>, drawstyle=<UNSET>, fillstyle=<UNSET>, gapcolor=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, marker=<UNSET>, markeredgecolor=<UNSET>, markeredgewidth=<UNSET>, markerfacecolor=<UNSET>, markerfacecoloralt=<UNSET>, markersize=<UNSET>, markevery=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, slope=<UNSET>, snap=<UNSET>, solid_capstyle=<UNSET>, solid_joinstyle=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xdata=<UNSET>, xy1=<UNSET>, xy2=<UNSET>, ydata=<UNSET>, zorder=<UNSET>)[源代码]#

一次性设置多个属性。

支持的属性有

属性

描述

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和图像左下角的两个偏移量

alpha

标量或无

animated

布尔

抗锯齿 或 aa

布尔

clip_box

BboxBase 或 None

clip_on

布尔

clip_path

补丁或(路径,变换)或无

颜色 或 c

color

dash_capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

dash_joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

dashes

浮点数序列(开/关墨水以点为单位)或(None, None)

数据

(2, N) 数组或两个一维数组

drawstyle 或 ds

{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, 默认: 'default'

figure

FigureSubFigure

fillstyle

{'full', 'left', 'right', 'bottom', 'top', 'none'}

gapcolor

color or None

gid

str

in_layout

布尔

标签

对象

linestyle 或 ls

{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}

linewidth 或 lw

浮动

标记

标记样式字符串,PathMarkerStyle

markeredgecolor 或 mec

color

markeredgewidth 或 mew

浮动

markerfacecolor 或 mfc

color

markerfacecoloralt 或 mfcalt

color

markersize 或 ms

浮动

markevery

None 或 int 或 (int, int) 或 slice 或 list[int] 或 float 或 (float, float) 或 list[bool]

鼠标悬停

布尔

path_effects

AbstractPathEffect 的列表

picker

float 或 callable[[Artist, Event], tuple[bool, dict]]

pickradius

浮动

光栅化

布尔

sketch_params

(scale: float, length: float, randomness: float)

斜率

浮动

snap

布尔值或无

solid_capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

solid_joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

transform

Transform

url

str

可见

布尔

xdata

一维数组

xy1

未知

xy2

未知

ydata

一维数组

zorder

浮动

set_slope(slope)[源代码][源代码]#

设置直线的 斜率 值。

备注

只有在使用 slope 参数创建线条时,才能设置 slope。如果线条是使用 xy2 创建的,请使用 set_xy2

参数:
斜率浮动

这条线的斜率。

set_xy1(x, y)[源代码][源代码]#

设置线的 xy1 值。

参数:
x, y浮动

线条要经过的点。

set_xy2(x, y)[源代码][源代码]#

设置线的 xy2 值。

备注

只有在使用 xy2 参数创建线条时,才能设置 xy2。如果线条是使用 slope 创建的,请使用 set_slope

参数:
x, y浮动

线条要经过的点。