0

我已经设法使用下面的代码制作了一组子hist2dImageGrid

from mpl_toolkits.axes_grid1 import ImageGrid

fig = figure(figsize(20, 60))
grid = ImageGrid(fig, 111, nrows_ncols=(1, 3), axes_pad=0.25)
for soa, ax in zip(soalist, grid):
    # grab my data from pandas DataFrame...
    samps = allsubs[allsubs['soa'] == soa]
    x, y = samps['x'], samps['y']

    # calls hist2d and returns the Image returned by hist2d
    img = gazemap(x, y, ax, std=True, mean=True)
    ax.set_title("{0} ms".format(soa * 1000))

# attempt to show a colorbar for that image       
grid.cbar_axes[-1].colorbar(img)

show()  # threw this in for good measure, but doesn't help!

我没有得到明确的错误(这很好,因为我传递了Imageto colorbar),但我的颜色条没有出现。是什么赋予了?

4

1 回答 1

1

好的,我修好了!

我所要做的就是将cbar_modeand cbar_locationkwargs 传递给ImageGrid

于 2013-04-23T15:51:03.793 回答