matplotlib.pyplot.axline¶
-
matplotlib.pyplot.axline(xy1, xy2=None, *, slope=None, **kwargs)[源代码]¶ 加一条无限长的直线。
直线可以由两点定义 xy1 和 xy2 ,或一点 xy1 和A 斜坡 .
这在屏幕上画了一条直线,不管x和y标度如何,因此也适用于在半对数图中画指数衰减,在对数图中画幂律,等等, 斜坡 只能与线性刻度一起使用;它对所有其他刻度没有明确的意义,因此行为未定义。请使用点指定线 xy1 , xy2 对于非线性比例。
参数: - xy1、xy2(浮标,浮标)
线要通过的点。或者 xy2 或 斜坡 必须给予。
- slope可选浮动
线条的坡度。或者 xy2 或 斜坡 必须给予。
返回: 其他参数: - **kwargs
有效Kwargs是
Line2D属性,但“transform”除外:财产 描述 agg_filter一种过滤函数,它接受一个(m,n,3)浮点数组和一个dpi值,并返回一个(m,n,3)数组。 alpha浮动或无 animated布尔 antialiased或者aa布尔 clip_boxBboxclip_on布尔 clip_path面片或(路径、变换)或无 color或c颜色 contains未知的 dash_capstyle“对接”、“圆形”、“突出” dash_joinstyle'miter'、'round'、'bevel' dashes浮动顺序(点中的开/关墨迹)或(无,无) data(2,N)阵列或两个一维阵列 drawstyle或ds{'default','steps','steps pre','steps mid','steps post'},default:'默认' figureFigurefillstyle'full'、'left'、'right'、'bottom'、'top'、'none' gidSTR in_layout布尔 label对象 linestyle或ls'-'、'-'、'-'、'-'、':'、'、'、'(偏移量、开/关顺序)、… linewidth或lw浮动 marker标记样式字符串, Path或MarkerStylemarkeredgecolor或mec颜色 markeredgewidth或者喵喵浮动 markerfacecolor或mfc颜色 markerfacecoloralt或mfcalt颜色 markersize或ms浮动 markeveryNone或int or(int,int)或slice或List [int] 或float或(float,float)或List [bool] path_effectsAbstractPathEffectpicker未知的 pickradius浮动 rasterized布尔或无 sketch_params(比例:浮动,长度:浮动,随机性:浮动) snap布尔或无 solid_capstyle“对接”、“圆形”、“突出” solid_joinstyle'miter'、'round'、'bevel' transformmatplotlib.transforms.TransformurlSTR visible布尔 xdata一维阵列 ydata一维阵列 zorder浮动
实例
画一条穿过(0,0)和(1,1)的粗红线:
>>> axline((0, 0), (1, 1), linewidth=4, color='r')