根据numpy.r_ 这里的numpy/scipy doc ,它"不是一个函数,因此不需要参数".
如果它不是一个函数,那么"函数"的正确用语是numpy.r_什么?
我有一个类似于这里发布的问题.不同之处在于,当我绘制两个通过sharex和sharey属性共享轴的子图时,我在绘图区域内得到了不需要的空白区域.设置后,白色空间仍然存在autoscale(False).例如,使用与上述帖子的答案类似的代码:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1)
ax.imshow(np.random.random((10,10)))
ax.autoscale(False)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax, sharey=ax) # adding sharex and sharey
ax2.imshow(np.random.random((10,10)))
ax2.autoscale(False)
plt.show()
Run Code Online (Sandbox Code Playgroud)
得到这个图像.
我也曾尝试ax.set_xlim(0, 10)和ax.set_xbound(0, 10)按照建议在这里,但无济于事.我怎样才能摆脱多余的空白?任何想法,将不胜感激.