MCPcopy
hub / github.com/matplotlib/matplotlib / axvline

Method axvline

lib/matplotlib/axes/_axes.py:831–911  ·  view source on GitHub ↗

Add a vertical line spanning the whole or fraction of the Axes. Note: If you want to set y-limits in data coordinates, use `~.Axes.vlines` instead. Parameters ---------- x : float, default: 0 x position in :ref:`data coordinates <coordin

(self, x=0, ymin=0, ymax=1, **kwargs)

Source from the content-addressed store, hash-verified

829
830 @_docstring.interpd
831 def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
832 """
833 Add a vertical line spanning the whole or fraction of the Axes.
834
835 Note: If you want to set y-limits in data coordinates, use
836 `~.Axes.vlines` instead.
837
838 Parameters
839 ----------
840 x : float, default: 0
841 x position in :ref:`data coordinates <coordinate-systems>`.
842
843 ymin : float, default: 0
844 The start y-position in :ref:`axes coordinates <coordinate-systems>`.
845 Should be between 0 and 1, 0 being the bottom of the plot, 1 the
846 top of the plot.
847
848 ymax : float, default: 1
849 The end y-position in :ref:`axes coordinates <coordinate-systems>`.
850 Should be between 0 and 1, 0 being the bottom of the plot, 1 the
851 top of the plot.
852
853 Returns
854 -------
855 `~matplotlib.lines.Line2D`
856 A `.Line2D` specified via two points ``(x, ymin)``, ``(x, ymax)``.
857 Its transform is set such that *x* is in
858 :ref:`data coordinates <coordinate-systems>` and *y* is in
859 :ref:`axes coordinates <coordinate-systems>`.
860
861 This is still a generic line and the vertical character is only
862 realized through using identical *x* values for both points. Thus,
863 if you want to change the *x* value later, you have to provide two
864 values ``line.set_xdata([3, 3])``.
865
866 Other Parameters
867 ----------------
868 **kwargs
869 Valid keyword arguments are `.Line2D` properties, except for
870 'transform':
871
872 %(Line2D:kwdoc)s
873
874 See Also
875 --------
876 vlines : Add vertical lines in data coordinates.
877 axvspan : Add a vertical span (rectangle) across the axis.
878 axline : Add a line with an arbitrary slope.
879
880 Examples
881 --------
882 * draw a thick red vline at *x* = 0 that spans the yrange::
883
884 >>> axvline(linewidth=4, color='r')
885
886 * draw a default vline at *x* = 1 that spans the yrange::
887
888 >>> axvline(x=1)

Callers 15

run_memleak_testFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
axvlineFunction · 0.80
test_date_axvlineFunction · 0.80
test_usetexFunction · 0.80
test_log_scalesFunction · 0.80
test_numpy_facadeFunction · 0.80

Calls 7

_check_no_unitsMethod · 0.95
get_pathMethod · 0.95
get_xboundMethod · 0.80
_process_unit_infoMethod · 0.80
add_lineMethod · 0.80
get_xaxis_transformMethod · 0.45

Tested by 15

test_date_axvlineFunction · 0.64
test_usetexFunction · 0.64
test_log_scalesFunction · 0.64
test_numpy_facadeFunction · 0.64
test_axvlineMethod · 0.64
test_eb_line_zorderFunction · 0.64
test_axlineFunction · 0.64
test_vline_limitFunction · 0.64