I am using the solution proposed here to plot an image in 3D using matplotlib
. However, even for very reasonable image sizes (128x128
), the refresh rate is annoyingly slow. On my computer, the following cannot go higher than 2 frames/s.
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import numpy as np
X, Y = np.meshgrid(np.arange(128), np.arange(128))
Z = np.zeros_like(X)
im = np.sin(X/10 + Y/100)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=plt.cm.BrBG(im), shade=False)
plt.show()
Is there any way to accelerate the above plot? I understand that mplot3d does not support hardware acceleration, but I feel the simple plot above ought to be faster even on CPU.