0

I have been trying to plot some figures and have the title for each row positioned on the left. The issue I face with using ImageGrid is that the title is cut off by the next figure as shown below.

enter image description here

for idx in range(0,1):
    fig  = plt.figure(idx, (15, 10))
    grid = ImageGrid(fig, 111, nrows_ncols=(3, 10), axes_pad=0.1, share_all=True)  

    # disable ticks
    grid[0].get_yaxis().set_ticks([])
    grid[0].get_xaxis().set_ticks([])

    # labels
    grid[0].set_ylabel("Input", fontsize=20, rotation=0)
    grid[10].set_ylabel("Ground Truth", fontsize=20, rotation=0)
    grid[20].set_ylabel("Prediction", fontsize=20, rotation=0)

    # images
    for j in range(10):
        grid[j].imshow(x_true[idx,j], cmap="gray")
        grid[j+10].imshow(x_true[idx,j+10], cmap="gray")
        grid[j+20].imshow(x_temp[idx,j], cmap="gray")

I was using subplots before this (see Subplots not aligned) and had the same issue as well. I have gone through a number of threads and solutions but none them have worked, yet.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kong
  • 2,202
  • 8
  • 28
  • 56

1 Answers1

0

Managed to find a solution finally. To use the labelpad argument in set_ylabel. How to print Y axis label horizontally in a matplotlib / pylab chart?

Kong
  • 2,202
  • 8
  • 28
  • 56