Plotly+Python: How to plot arrows in 3D?(Plotly+Python:如何在 3D 中绘制箭头?)
问题描述
我正在使用 Plotly+Python.如何在 3D 中绘制单个矢量(用箭头表示)?
I am using Plotly+Python. How can I plot a single vector, as represented by an arrow, in 3D?
注释(这本来是一种 hacky 的解决方法)仅是 2D 的,而 Quiver 图也是仅 2D 的.
Annotations (which would have been a hacky workaround) are 2D-only, and Quiver plots are also 2D-only.
推荐答案
我认为你可以在 3D 中使用线和锥的组合.假设你的线从 (x, y, z) 开始,到 (p, q, r) 结束,那么 cone 接受 XYZ 和 UV W.现在你可以设置 X = p, Y= q, Z=r 是中间点圆锥的底部.要使锥体指向与线相同的方向但小于线的长度(例如 10%),您可以设置 U = 0.1*(px)、V = 0.1*(qy)、W = 0.1*(rz).
I think you can use a combination of line and cone in 3D. Suppose your line starts from (x, y, z) and ends at (p, q, r), then cone accepts X Y Z and U V W. Now you can set X = p, Y= q, Z=r which is middle point of base of cone. To get cone pointing in same direction as line but less than length of line (say 10%), you can set U = 0.1*(p-x), V = 0.1*(q-y), W = 0.1*(r-z).
https://plotly.com/python/cone-plot/
这篇关于Plotly+Python:如何在 3D 中绘制箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Plotly+Python:如何在 3D 中绘制箭头?


- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01