matplotlib.lines.AxLine — Matplotlib 3.10.1 documentation (original) (raw)

class matplotlib.lines.AxLine(xy1, xy2, slope, **kwargs)[source]#

Bases: Line2D

A 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:

rendererRendererBase subclass.

Notes

This method is overridden in the Artist subclasses.

get_slope()[source]#

Return the slope value of the line.

get_transform()[source]#

Return the Transform instance 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=, alpha=, animated=, antialiased=, clip_box=, clip_on=, clip_path=, color=, dash_capstyle=, dash_joinstyle=, dashes=, data=, drawstyle=, fillstyle=, gapcolor=, gid=, in_layout=, label=, linestyle=, linewidth=, marker=, markeredgecolor=, markeredgewidth=, markerfacecolor=, markerfacecoloralt=, markersize=, markevery=, mouseover=, path_effects=, picker=, pickradius=, rasterized=, sketch_params=, slope=, snap=, solid_capstyle=, solid_joinstyle=, transform=, url=, visible=, xdata=, xy1=, xy2=, ydata=, zorder=)[source]#

Set multiple properties at once.

Supported properties are

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 useset_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 useset_slope.

Parameters:

xy2tuple[float, float]

Points for the line to pass through.