matplotlib.lines.AxLine#

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

Bases:Line2D

A helper class that implementsaxline, by recomputing the artisttransform 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.Bothxy2 andslope must be passed, but one of them must be None.

slopefloat or None

The slope of the line. Bothxy2 andslope must be passed, but one ofthem 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 theslope value of the line.

get_transform()[source]#

Return theTransform instance used by this artist.

get_xy1()[source]#

Return thexy1 value of the line.

get_xy2()[source]#

Return thexy2 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

agg_filter

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

alpha

float or None

animated

bool

antialiased oraa

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

color orc

color

dash_capstyle

CapStyle or {'butt', 'projecting', 'round'}

dash_joinstyle

JoinStyle or {'miter', 'round', 'bevel'}

dashes

sequence of floats (on/off ink in points) or (None, None)

data

(2, N) array or two 1D arrays

drawstyle ords

{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'

figure

Figure orSubFigure

fillstyle

{'full', 'left', 'right', 'bottom', 'top', 'none'}

gapcolor

color or None

gid

str

in_layout

bool

label

object

linestyle orls

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidth orlw

float

marker

marker style string,Path orMarkerStyle

markeredgecolor ormec

color

markeredgewidth ormew

float

markerfacecolor ormfc

color

markerfacecoloralt ormfcalt

color

markersize orms

float

markevery

None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]

mouseover

bool

path_effects

list ofAbstractPathEffect

picker

float or callable[[Artist, Event], tuple[bool, dict]]

pickradius

float

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

slope

float

snap

bool or None

solid_capstyle

CapStyle or {'butt', 'projecting', 'round'}

solid_joinstyle

JoinStyle or {'miter', 'round', 'bevel'}

transform

Transform

url

str

visible

bool

xdata

1D array

xy1

unknown

xy2

unknown

ydata

1D array

zorder

float

set_slope(slope)[source]#

Set theslope value of the line.

Note

You can only setslope if the line was created using theslopeparameter. If the line was created usingxy2, please useset_xy2.

Parameters:
slopefloat

The slope of the line.

set_xy1(*args,**kwargs)[source]#

Set thexy1 value of the line.

Parameters:
xy1tuple[float, float]

Points for the line to pass through.

set_xy2(*args,**kwargs)[source]#

Set thexy2 value of the line.

Note

You can only setxy2 if the line was created using thexy2parameter. If the line was created usingslope, please useset_slope.

Parameters:
xy2tuple[float, float]

Points for the line to pass through.