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 中绘制箭头?


基础教程推荐
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01