如果我在Matplotlib中进行三维打印:
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
x_labels = [10,20,30]
x = [1,2,3,4]
y = [3,1,5,1]
legend = False
for label in x_labels:
x_3d = label*np.ones_like(x)
ax.plot(x_3d, x, y, color='black', label='GMM')
if legend == False:
ax.legend()
legend = True
ax.set_zlabel('test')
它将产生:
左侧有过多的空白。我想知道能不能把它处理掉?在
可能已经太迟了,但我也遇到了类似的问题,这里是我删除空白的方法:使用
fig.subplot_adjust()
将左/右放置在正常区域之外。在您的例子中,我发现fig.subplot_adjust(left=-0.11)
给出了一个合理的结果。在完整代码如下:
相关问题 更多 >
编程相关推荐