Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Matplotlib LocatableAxes xtick标签_Python_Matplotlib - Fatal编程技术网

Python Matplotlib LocatableAxes xtick标签

Python Matplotlib LocatableAxes xtick标签,python,matplotlib,Python,Matplotlib,我尝试在网格中绘制多个图形,并标记其x和y记号,即: 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, # similar to subplot(111)

我尝试在网格中绘制多个图形,并标记其x和y记号,即:

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,  # similar to subplot(111)
                 nrows_ncols=(2, 2),  # creates 2x2 grid of axes
                 axes_pad=0.1,  # pad between axes in inch.
                 )

for i in range(4):
    grid[i].imshow(im)  # The AxesGrid object work as a list of axes.
    grid[i].set_xticks(np.arange(im.shape[0]))
    grid[i].set_yticks(np.arange(im.shape[0]))

plt.show()

我如何将这些记号标签改为
[“a”、“b”、“c”、“j”]

我尝试了
grid[I]。设置了xtickslabels()
,但得到了错误:

AttributeError:'locatablexes'对象没有属性“set\xtickslabels”
它是
set\xticklabels
,例如:

grid[i].set_xticklabels(["a","b","c"])

你们错了,方法的正确名称是
set\xticklabels
,这太愚蠢了。