简体   繁体   English

Plot 3D mesh using 3D numpy array and 2D numpy array

[英]Plot 3D mesh using 3D numpy array and 2D numpy array

I have a 3D numpy array Lattice[][][], and a 2D numpy array Trajectory[][].我有一个 3D numpy 阵列 Lattice[][][] 和一个 2D numpy 阵列 Trajectory[][]。 I want the indices i/j/k of Lattice to be the coordinate axes and the value contained in the tensor element to be plotted as a colored dot, making a 3D mesh maybe and I want to plot Trajectory where the Trajectory[p][0]/[1]/[2] contains the coordinates, and the index p is the iteration number - so this I want to plot as a 3D line, hopefully inside the mesh.我希望 Lattice 的索引 i/j/k 作为坐标轴,并将张量元素中包含的值绘制为彩色点,从而制作 3D 网格,我想要 plot 轨迹,其中轨迹 [p][ 0]/[1]/[2] 包含坐标,索引 p 是迭代次数 - 所以我想将 plot 作为 3D 线,希望在网格内。 I have no idea from where to start, is it possible in matplotlib?我不知道从哪里开始,是否可以在 matplotlib 中?

You could definetly use matplotlib.您可以明确地使用 matplotlib。 Check this link:https://matplotlib.org/2.0.2/mpl_toolkits/mplot3d/tutorial.html检查此链接:https://matplotlib.org/2.0.2/mpl_toolkits/mplot3d/tutorial.html

But you could also try a different package, like Plotly: https://plotly.com/python/3d-charts/但您也可以尝试不同的 package,例如 Plotly: https://plotly.com/python/3d-charts/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM