mpl_toolkits.mplot3d.art3d.Line3D#

classmpl_toolkits.mplot3d.art3d.Line3D(xs,ys,zs,*args,axlim_clip=False,**kwargs)[source]#

Bases:Line2D

3D line object.

Note

Useget_data_3d to obtain the data associated with the line.get_data,get_xdata, andget_ydata returnthe x- and y-coordinates of the projected 2D-line, not the x- and y-data ofthe 3D-line. Similarly, useset_data_3d to set the data, notset_data,set_xdata, andset_ydata.

Parameters:
xsarray-like

The x-data to be plotted.

ysarray-like

The y-data to be plotted.

zsarray-like

The z-data to be plotted.

*args, **kwargs

Additional arguments are passed toLine2D.

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_data_3d()[source]#

Get the current data

Returns:
verts3dlength-3 tuple or array-like

The current data as a tuple or array-like.

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>,data_3d=<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>,snap=<UNSET>,solid_capstyle=<UNSET>,solid_joinstyle=<UNSET>,transform=<UNSET>,url=<UNSET>,visible=<UNSET>,xdata=<UNSET>,ydata=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

a.set(a=A,b=B,c=C)

is equivalent to

a.set_a(A)a.set_b(B)a.set_c(C)

In addition to the full property names, aliases are also supported, e.g.set(lw=2) is equivalent toset(linewidth=2), but it is an errorto pass both simultaneously.

The order of the individual setter calls matches the order of parametersinset(). However, most properties do not depend on each other sothat order is rarely relevant.

Supported properties are

Property

Description

3d_properties

float or array of floats

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

data_3d

unknown

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

{'-', '--', '-.', ':', '', ...} or (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)

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

ydata

1D array

zorder

float

set_3d_properties(zs=0,zdir='z',axlim_clip=False)[source]#

Set thez position and direction of the line.

Parameters:
zsfloat or array of floats

The location along thezdir axis in 3D space to position theline.

zdir{'x', 'y', 'z'}

Plane to plot line orthogonal to. Default: 'z'.Seeget_dir_vector for a description of the values.

axlim_clipbool, default: False

Whether to hide lines with an endpoint outside the axes view limits.

Added in version 3.10.

set_data_3d(*args)[source]#

Set the x, y and z data

Parameters:
xarray-like

The x-data to be plotted.

yarray-like

The y-data to be plotted.

zarray-like

The z-data to be plotted.

Notes

Accepts x, y, z arguments or a single array-like (x, y, z)

Examples usingmpl_toolkits.mplot3d.art3d.Line3D#

3D stem

3D stem