13

嗨,有谁知道是否有办法以允许它们仍然旋转的格式保存 matplotlib 3d 旋转图?也许是一个特定的程序?

代码是:

from numpy import *
import pylab as p
import mpl_toolkits.mplot3d.axes3d as p3

A=transpose(genfromtxt("Z:/Desktop/Project/bhmqntm-code/RichardsonRK4.csv", unpack=True, delimiter=','))

T=A[:,0]
X=A[:,1]
P=A[:,2]

fig=p.figure()
ax = p3.Axes3D(fig)
ax.scatter(X,P,T,s=1,cmap=cm.jet)
ax.set_xlabel('X')
ax.set_ylabel('P')
ax.set_zlabel('T')
p.show()#I would like this to be something like savefig('Z:/Desktop/Project/bhmqntm-code/plot3d_ex.png') but with a file ending of a program that would save the 3d capability

我不确定是否确实存在执行此操作的程序,但如果有人知道它会非常有帮助。谢谢。

4

1 回答 1

3

我认为 matplotlib 做不到。我找到的解决方案是制作图表以在浏览器中显示它们。例如使用plot.ly

一个例子:https ://plot.ly/python/ipython-notebook-tutorial/#3d-plotting

于 2016-12-07T22:06:55.253 回答