python 3D 文字添加功实现

阅读: 评论:0

python 3D 文字添加功实现

python 3D 文字添加功实现

Text

  • Axes3D.``text(xyzszdir=None, **kwargs)

      text的内容其实也很繁杂,需要用一篇内容去探讨,在三维中很重要的一点是要学会二维、三维文字的添加。

from mpl_toolkits.mplot3d import Axes3D  # noqa: F401 unused importimport matplotlib.pyplot as pltfig = plt.figure()
ax = a(projection='3d')# Demo 1: zdir
zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
xs = (1, 4, 4, 9, 4, 1)
ys = (2, 5, 8, 10, 1, 2)
zs = (10, 3, 8, 9, 1, 8)for zdir, x, y, z in zip(zdirs, xs, ys, zs):label = '(%d, %d, %d), dir=%s' % (x, y, z, (x, y, z, label, zdir)# Demo 2: color
ax.text(9, 0, 0, "red", color='red')# Demo 3: text2D
# Placement 0, 0 would be the bottom left, 1, 1 would be the top right.
ax.text2D(0.05, 0.95, "2D Text", transform&#ansAxes)# Tweaking display region and labels
ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
ax.set_zlim(0, 10)
ax.set_xlabel('X axis')
ax.set_ylabel('Y axis')
ax.set_zlabel('Z axis')plt.show()

 

本文发布于:2024-01-28 03:18:34,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/17063831224407.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:文字   python
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23