I want to show 3 projections of 3d numpy array side by side. A problem that projections have totally different sizes.
My current approach is next:
fig, axis = plt.subplots(nrows=2, ncols=2, squeeze=False, dpi=1)
fig.set_size_inches(p.shape[2] + p.shape[1], p.shape[0]+p.shape[1] )
axis[0, 0].imshow(getProjectionImageMean(p, minValue, maxValue, axis=1), cmap=plt.cm.gray)
axis[0, 1].imshow(getProjectionImageMean(p, minValue, maxValue, axis=2), cmap=plt.cm.gray)
axis[1, 0].imshow(getProjectionImageMean(p, minValue, maxValue, axis =0), cmap=plt.cm.gray)
for i in range(1):
for k in range(2):
axis[i, k].set_axis_off()
fig.subplots_adjust(wspace=0, hspace=0, top=1, bottom=0, left=0, right=1)
plt.savefig(OUTPUT_PATH + patient + "/projections.png", dpi=1)
The getProjectionImageMean
is just a function that makes np.mean by some axis in the end.
Problem that projection can have next sizes, for example, (180, 1024), (180, 512) (512, 1024)
So I want the first column to be 2/3 of width. And first row to be 180/(180+512) of the height.
While matplotlib always give 1/n to every row and column.
Any workaround or even another library appreciated.
Thank you.