使用gridspec - matplotlib绘制两个并排的三维图形

我想在gridspec软件包中并排绘制两个三维图形。

考虑下面的例子

from mpl_toolkits.mplot3d import Axes3D 
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

G = gridspec.GridSpec(3, 2)

ax1 = plt.subplot(G[0:2, 0])
#ax1 = plt.axes(projection="3d")
#ax1.plot3D([1,2,3], [1,2,3], [1,2,3])


ax2 = plt.subplot(G[0:2, 1])
#ax2 = plt.axes(projection="3d")
#ax2.plot3D([1,2,3], [1,2,3], [1,2,3])

它创建了

?

?

通过删除路线标志,可以得到3D图。但由于某种原因,这里只有一个3D图

?

?

哪里出了问题,如何在gridspec中并排获得3d图形?

转载请注明出处:http://www.xinxianzhihui.com/article/20230526/1640759.html