import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
im = np.arange(100)
im.shape = 10, 10
fig = plt.figure(1, (4., 4.))
grid = ImageGrid(fig, 111,
nrows_ncols=(2, 2),
axes_pad=0.1,
)
for i in range(4):
grid[i].imshow(im)
plt.show()
答案 0 :(得分:0)
使用fig.text()
添加注释,使用axes.set_title()
标题轴。
示例:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
im = np.arange(100)
im.shape = 10, 10
fig = plt.figure(1, (4., 4.))
grid = ImageGrid(fig, 111,
nrows_ncols=(2, 2),
axes_pad=0.4,
)
for axes in grid:
axes.set_title("TITLE", fontdict=None, loc='center', color = "k")
axes.imshow(im)
fig.text(0.7,0.2,"Anotation", color ="k")
fig.text(0.2,0.7,"Anotation", color ="k")
plt.show()