SarthakJariwala/seaborn-image

Titles in ImageGrid

faisalalnasser13 opened this issue · 2 comments

can I add a title to each image?

Yes, you can access the underlying individual axes using the .axes attribute in ImageGrid and then use .set_title() method

g = isns.ImageGrid(cells)

# g.axes is a numpy array of matplotlib axes
for ax in g.axes.ravel():
    ax.set_title("cells title")

If you have different titles for individual axes:

g = isns.ImageGrid(cells, slices=[10, 20, 30, 40])

titles = ["A", "B", "C", "D"]
for ax, title in zip(g.axes.ravel(), titles):
    ax.set_title(title)

This works, but reduces the size of the images to make room for the title. Then, the horizontal and vertical spacing between the images is not identical any more. How could I achieve the same thing, but by adding more space to each subplot to make room for the title?
Thanks for your help!