mpl_toolkits.mplot3d.art3d.Line3D#

class mpl_toolkits.mplot3d.art3d.Line3D(xs, ys, zs, *args, **kwargs)[源代码][源代码]#

基类:Line2D

3D 线条对象。

备注

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

参数:
xs类数组

要绘制的 x 数据。

ys类数组

要绘制的 y 数据。

zs类数组

要绘制的 z 数据。

*args, **kwargs

其他参数传递给 Line2D

draw(renderer)[源代码][源代码]#

使用给定的渲染器绘制艺术家(及其子项)。

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

参数:
渲染器 : RendererBase 子类。RendererBase 子类。

注释

此方法在 Artist 子类中被重写。

get_data_3d()[源代码][源代码]#

获取当前数据

返回:
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>)[源代码]#

一次性设置多个属性。

支持的属性有

属性

描述

3d_properties

浮点数或浮点数数组

agg_filter

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

alpha

标量或无

animated

布尔值

抗锯齿 或 aa

布尔值

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

补丁或(路径,变换)或无

颜色 或 c

color

dash_capstyle

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

dash_joinstyle

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

dashes

浮点数序列(开/关墨水以点为单位)或(None, None)

数据

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

data_3d

未知

drawstyle 或 ds

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

figure

FigureSubFigure

fillstyle

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

gapcolor

color or None

gid

str

in_layout

布尔值

标签

对象

linestyle 或 ls

{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}

linewidth 或 lw

浮动

标记

标记样式字符串,PathMarkerStyle

markeredgecolor 或 mec

color

markeredgewidth 或 mew

浮动

markerfacecolor 或 mfc

color

markerfacecoloralt 或 mfcalt

color

markersize 或 ms

浮动

markevery

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

鼠标悬停

布尔值

path_effects

AbstractPathEffect 列表

picker

浮点数或可调用对象[[Artist, Event], 元组[布尔值, 字典]]

pickradius

浮动

光栅化

布尔值

sketch_params

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

snap

布尔值或无

solid_capstyle

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

solid_joinstyle

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

transform

Transform

url

str

可见

布尔值

xdata

1D 数组

ydata

1D 数组

zorder

浮动

set_3d_properties(zs=0, zdir='z')[源代码][源代码]#

设置线的 z 位置和方向。

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

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

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

要绘制正交线的平面。默认值:'z'。有关值的描述,请参见 get_dir_vector

set_data_3d(*args)[源代码][源代码]#

设置 x, y 和 z 数据

参数:
x类数组

要绘制的 x 数据。

y类数组

要绘制的 y 数据。

z类数组

要绘制的 z 数据。

注释

接受 x, y, z 参数或单个数组形式 (x, y, z)

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

3D 茎

3D stem