matplotlib.axes.Axes.axvline

Axes.axvline(x=0, ymin=0, ymax=1, **kwargs)[源代码]

在轴上添加一条垂直线。

参数:
x浮点,默认值:0

垂直线数据坐标中的X位置。

ymin浮点,默认值:0

应该介于0和1之间,0是绘图的底部,1是绘图的顶部。

ymax浮点,默认值:1

应该介于0和1之间,0是绘图的底部,1是绘图的顶部。

返回:
Line2D
其他参数:
**kwargs

有效的关键字参数是 Line2D 属性,但“transform”除外:

财产 描述
agg_filter 一种过滤函数,它接受一个(m,n,3)浮点数组和一个dpi值,并返回一个(m,n,3)数组。
alpha 浮动或无
animated 布尔
antialiased 或者aa 布尔
clip_box Bbox
clip_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:'默认'
figure Figure
fillstyle 'full'、'left'、'right'、'bottom'、'top'、'none'
gid STR
in_layout 布尔
label 对象
linestyle 或ls '-'、'-'、'-'、'-'、':'、'、'、'(偏移量、开/关顺序)、…
linewidth 或lw 浮动
marker 标记样式字符串, PathMarkerStyle
markeredgecolor 或mec 颜色
markeredgewidth 或者喵喵 浮动
markerfacecolor 或mfc 颜色
markerfacecoloralt 或mfcalt 颜色
markersize 或ms 浮动
markevery None或int or(int,int)或slice或List [int] 或float或(float,float)或List [bool]
path_effects AbstractPathEffect
picker 未知的
pickradius 浮动
rasterized 布尔或无
sketch_params (比例:浮动,长度:浮动,随机性:浮动)
snap 布尔或无
solid_capstyle “对接”、“圆形”、“突出”
solid_joinstyle 'miter'、'round'、'bevel'
transform matplotlib.transforms.Transform
url STR
visible 布尔
xdata 一维阵列
ydata 一维阵列
zorder 浮动

参见

vlines
在数据坐标中添加垂直线。
axvspan
在轴上添加一个垂直跨距(矩形)。
axline
添加具有任意坡度的线。

实例

  • 在…画一个粗红色的V线 x =0,跨越范围:

    >>> axvline(linewidth=4, color='r')
    
  • 在以下位置绘制默认vline x =1,跨越范围:

    >>> axvline(x=1)
    
  • 在以下位置绘制默认vline x =5,跨越了Y范围的中半部分:

    >>> axvline(x=.5, ymin=0.25, ymax=0.75)