2024-10-01 13:32:24 发布
网友
我试图基于大型数据集和3D绘制椭球体,我最初使用VTK的VKTParametericEllioid模块创建椭球体,但不能将其设置为中心,也不能在同一窗口中添加多个椭球体。在脚本中,我也使用了plotly。我愿意使用任何可以帮助创建和显示三维椭球体的工具,以及在同一窗口中创建和显示所有椭球体并保持交互的工具
MatPrtLIB有一个你可以考虑的3D库。添加%matplotlib notebook可以让您拖动到想要的方向。下面是来自the documentation的一些示例代码:
%matplotlib notebook
%matplotlib notebook from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='3d') u = np.linspace(0, 2 * np.pi, 100) v = np.linspace(0, np.pi, 100) x = 10 * np.outer(np.cos(u), np.sin(v)) y = 5 * np.outer(np.sin(u), np.sin(v)) z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) x1 = 3 * np.outer(np.cos(u), np.sin(v)) + 4 y1 = 5 * np.outer(np.sin(u), np.sin(v)) + 7 z1 = 2 * np.outer(np.ones(np.size(u)), np.cos(v)) + 2 x2 = 5 * np.outer(np.cos(u), np.sin(v)) -11 y2 = 6.6 * np.outer(np.sin(u), np.sin(v)) - 3 z2 = 2 * np.outer(np.ones(np.size(u)), np.cos(v)) + 6 # Plot the surfaces ax.plot_surface(x, y, z, color='b', alpha = .2) ax.plot_surface(x1, y1, z1, color='r', alpha = .1) ax.plot_surface(x2, y2, z2, color='g', alpha = .3) plt.show()
MatPrtLIB有一个你可以考虑的3D库。添加
%matplotlib notebook
可以让您拖动到想要的方向。下面是来自the documentation的一些示例代码:相关问题 更多 >
编程相关推荐