Plotly+Python:如何在 3D 中绘制箭头?

Plotly+Python: How to plot arrows in 3D?(Plotly+Python:如何在 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 中绘制箭头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Leetcode 234: Palindrome LinkedList(Leetcode 234:回文链接列表)
How do I read an Excel file directly from Dropbox#39;s API using pandas.read_excel()?(如何使用PANDAS.READ_EXCEL()直接从Dropbox的API读取Excel文件?)
subprocess.Popen tries to write to nonexistent pipe(子进程。打开尝试写入不存在的管道)
I want to realize Popen-code from Windows to Linux:(我想实现从Windows到Linux的POpen-code:)
Reading stdout from a subprocess in real time(实时读取子进程中的标准输出)
How to call type safely on a random file in Python?(如何在Python中安全地调用随机文件上的类型?)