Skip to content
Advertisement

Add title to each grid with ImageGrid

I’m using matplotlib’s mpl_toolkits.axes_grid1.ImageGrid to generate two grids, each size (3,3):

JavaScript

enter image description here

I’m trying to figure out how to add a title to each ImageGrid, so that there would be two titles, one for the left 3×3 grid, and one for the right one.

It seems like this should be pretty straightforward, but I haven’t been able to figure it out so far. Anybody familiar with this and have any good ideas? Thanks!

Advertisement

Answer

There doesn’t appear to be a built in way to set the title of an ImageGrid.

However, you could get the list of axes objects that are used to make the ImageGrid using grid1.axes_all, then set the title of the top middle one. It’s a bit of a workaround, but works in this case.

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement