matplotlib.pyplot.axvline¶
-
matplotlib.pyplot.axvline(x=0, ymin=0, ymax=1, **kwargs)[源代码]¶ 在轴上添加一条垂直线。
参数: - x浮点,默认值:0
垂直线数据坐标中的X位置。
- ymin浮点,默认值:0
应该介于0和1之间,0是绘图的底部,1是绘图的顶部。
- ymax浮点,默认值:1
应该介于0和1之间,0是绘图的底部,1是绘图的顶部。
返回: 其他参数: - **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浮动
实例
在…画一个粗红色的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)