matplotlib.lines.AxLine
- classmatplotlib.lines.AxLine(xy1, xy2, slope, **kwargs)[source]
-
Bases:
Line2DA helper class that implements
axline, by recomputing the artist transform at draw time.- Parameters:
-
- xy1(float, float)
-
The first set of (x, y) coordinates for the line to pass through.
- xy2(float, float) or None
-
The second set of (x, y) coordinates for the line to pass through. Both xy2 and slope must be passed, but one of them must be None.
- slopefloat or None
-
The slope of the line. Both xy2 and slope must be passed, but one of them must be None.
- draw(renderer)[source]
-
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (
Artist.get_visiblereturns False).- Parameters:
-
-
renderer
RendererBasesubclass.
-
renderer
Notes
This method is overridden in the Artist subclasses.
- get_slope()[source]
-
Return the slope value of the line.
- get_transform()[source]
-
Return the
Transforminstance used by this artist.
- get_xy1()[source]
-
Return the xy1 value of the line.
- get_xy2()[source]
-
Return the xy2 value of the line.
- 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>)[source]
-
Set multiple properties at once.
Supported properties are
Property
Description
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
float or None
bool
antialiasedoraabool
BboxBaseor Nonebool
Patch or (Path, Transform) or None
CapStyleor {'butt', 'projecting', 'round'}JoinStyleor {'miter', 'round', 'bevel'}sequence of floats (on/off ink in points) or (None, None)
(2, N) array or two 1D arrays
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
{'full', 'left', 'right', 'bottom', 'top', 'none'}
color or None
str
bool
object
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
float
marker style string,
PathorMarkerStylefloat
markersizeormsfloat
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
bool
list of
AbstractPathEffectfloat or callable[[Artist, Event], tuple[bool, dict]]
float
bool
(scale: float, length: float, randomness: float)
float
bool or None
CapStyleor {'butt', 'projecting', 'round'}JoinStyleor {'miter', 'round', 'bevel'}str
bool
1D array
unknown
unknown
1D array
float
- set_slope(slope)[source]
-
Set the slope value of the line.
Note
You can only set slope if the line was created using the slope parameter. If the line was created using xy2, please use
set_xy2.- Parameters:
-
- slopefloat
-
The slope of the line.
- set_xy1(*args, **kwargs)[source]
-
Set the xy1 value of the line.
- Parameters:
-
- xy1tuple[float, float]
-
Points for the line to pass through.
- set_xy2(*args, **kwargs)[source]
-
Set the xy2 value of the line.
Note
You can only set xy2 if the line was created using the xy2 parameter. If the line was created using slope, please use
set_slope.- Parameters:
-
- xy2tuple[float, float]
-
Points for the line to pass through.
© 2012–2026 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/stable/api/_as_gen/matplotlib.lines.AxLine.html