Plotly+Python:如何在 3D 中绘制箭头? [英] Plotly+Python: How to plot arrows in 3D?

查看:24
本文介绍了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 中绘制箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆