来自here
的代码从下面的代码中,我们得到4个子图。我想跳过vmin和vmax。要知道vmin和vmax,我必须读取所有数据,然后确定vmax vmin,然后绘制图,这很麻烦。是否可以跳过vman和vmin?
import numpy as np
import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2, ncols=2)
for ax in axes.flat:
im = ax.imshow(np.random.random((10,10)), vmin=0, vmax=1)
fig.subplots_adjust(right=0.8)
cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
fig.colorbar(im, cax=cbar_ax)
plt.show()