matplotlib.lines.AxLine#

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_visible returns 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=<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

scalar or None

animated

bool

antialiased or aa

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

color or c

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 or ds

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

figure

Figure or SubFigure

fillstyle

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

gapcolor

color or None

gid

str

in_layout

bool

label

object

linestyle or ls

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

linewidth or lw

float

marker

marker style string, Path or MarkerStyle

markeredgecolor or mec

color

markeredgewidth or mew

float

markerfacecolor or mfc

color

markerfacecoloralt or mfcalt

color

markersize or ms

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 of AbstractPathEffect

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