mpl_toolkits.mplot3d.art3d.Line3D#

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

基类:Line2D

3D 线对象。

注意

使用 get_data_3d 获取与该线关联的数据。get_dataget_xdataget_ydata 返回投影的 2D 线的 x 和 y 坐标,而不是 3D 线的 x 和 y 数据。同样,使用 set_data_3d 来设置数据,而不是 set_dataset_xdataset_ydata

参数:
xsarray-like (类数组)

要绘制的 x 数据。

ysarray-like (类数组)

要绘制的 y 数据。

zsarray-like (类数组)

要绘制的 z 数据。

*args, **kwargs

附加参数传递给 Line2D

draw(renderer)[source]#

使用给定的渲染器绘制 Artist(及其子对象)。

如果 artist 不可见(Artist.get_visible 返回 False),则此操作无效。

参数:
rendererRendererBase 子类。

备注

此方法在 Artist 子类中被覆盖。

get_data_3d()[source]#

获取当前数据

返回:
verts3d长度为 3 的元组或类数组

当前数据以元组或类数组形式。

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]#

一次性设置多个属性。

支持的属性包括:

属性

描述

3d_properties

float 或 浮点数数组

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量

alpha

浮点数或 None

animated

布尔值

antialiasedaa

布尔值

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

colorc

color

dash_capstyle

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

dash_joinstyle

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

dashes

浮点数序列(点中的开/关墨迹)或 (None, None)

data

(2, N) 数组或两个一维数组

data_3d

未知

drawstyleds

{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'},默认值: 'default'

figure (图形)

FigureSubFigure

fillstyle

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

gapcolor

颜色 或 None

gid

str

in_layout

布尔值

label

object

linestylels

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

linewidthlw

浮点数

marker

marker style string, PathMarkerStyle

markeredgecolormec

color

markeredgewidthmew

浮点数

markerfacecolormfc

color

markerfacecoloraltmfcalt

color

markersizems

浮点数

markevery

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

mouseover

布尔值

path_effects

AbstractPathEffect 列表

picker

浮点数或 callable[[Artist, Event], tuple[bool, dict]]

pickradius

浮点数

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

solid_capstyle

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

solid_joinstyle

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

transform

变换

url

str

visible

布尔值

xdata

一维数组

ydata

一维数组

zorder

浮点数

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

设置线的 z 位置和方向。

参数:
zs浮点数或浮点数数组

沿 3D 空间中 zdir 轴线的位置。

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

线正交于的绘制平面。默认值:'z'。有关值的说明,请参阅 get_dir_vector

axlim_clip布尔值, 默认值: False

是否隐藏端点超出坐标轴视图限制的线条。

set_data_3d(*args)[source]#

设置 x、y 和 z 数据

参数:
x类数组

要绘制的 x 数据。

y类数组

要绘制的 y 数据。

z类数组

要绘制的 z 数据。

备注

接受 x、y、z 参数或单个类数组 (x, y, z)

使用 mpl_toolkits.mplot3d.art3d.Line3D 的示例#

三维茎叶图

三维茎叶图