在Python3中matplotlib是否较慢?

时间:2017-03-12 14:26:21

标签: matplotlib python-3.6

我最近从2.7切换到3.6。我正在用pyplot和。做3D图 它比以前慢得多,特别是在拖动以改变视点时,即使是非常简单的情节。这是一个常见的问题吗?

示例:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection

fig = plt.figure()
ax = Axes3D(fig)
x = [0.,1.,1.]
y = [0.,0.,1.]
z = [0.,1.,0.]
verts = [list(zip(x,y,z))]

ax.add_collection3d(Poly3DCollection(verts))
plt.show()

1 个答案:

答案 0 :(得分:2)

在以下情况之后,速度从糟糕到快速提高:

import matplotlib
print(matplotlib.get_backend())  # MacOSX
matplotlib.use('Qt5Agg')  # the backend must be changed before
                          # importing pyplot
import matplotlib.pyplot as plt