How to display 10 sets of 26 images in a plot?
2 views (last 30 days)
Show older comments
So here is the deal: I have 5 sets of 26 images that I want to display before and after processing - 10 sets overall. The processed images are aranged in a processed folder in a manner described in this image.
Researching the matlab website I managed to do stuff like that: (attached pdf)
And also, a little bit better, for each set I managed to produce something like this:
Which is processed and unprocessed images of the same set. I used subplot, and the following code:
for i=1:26
% Display after recon
w_pr = tiledlayout(w,1,1);
w_pr.Layout.Tile = i;
w_pr.Layout.TileSpan = [1 1];
nexttile(w_pr);
load("1_"+string(i)+".mat");
imagesc(recon_image)
axis off
title("t="+string(i))
end
for i=1:26
% Display before recon
w_unpr = tiledlayout(w,1,1);
w_unpr.Layout.Tile = i+26;
w_unpr.Layout.TileSpan = [1 1];
nexttile(w_unpr);
imagesc(abs(SepImages(:,:,i,1)))
axis off
title("t="+string(i))
end
So what's the problem? Large margins and thus small images, and I ca'nt label properly with times and names of the sets. Can't figure out how to make it more neat, readable and easthetically pleasing. I'd like to be able clearly compare images of the same set of the corresponding t=i.
Thanks all.
0 Comments
Accepted Answer
DGM
on 22 May 2023
Edited: DGM
on 22 May 2023
If you arrange your plots in a regular grid, you don't need all the labels between them. You can move the labels to the edge and read it as a table of images with labels for the rows and columns. That improves both density and readability.
You might not be able to fit all 26 on one page, but split across two pages, it would still be easy enough to read. If you use the tilespacing options for the layout object, you can pack everything tightly.
% size of test image
sz = [10 20];
testdata = rand([sz 26 5]); % 5 sets of fake data
t = 1:26;
setnames = {'apple','banana','cherry','pear','orange'};
tiling = [5 5]; % number of plots per page [rows cols]
fontsize = 10;
htl = tiledlayout(tiling(1),tiling(2));
ht1.TileSpacing = 'none'; % set the tile spacing as tight as you want
for tidx = 1:tiling(1)
% index through the images in each set
for setidx = 1:tiling(2)
% index between sets
nexttile
thisdata = testdata(:,:,tidx,setidx);
imagesc(thisdata)
axis off
% put labels only on the sides
if setidx == 1
ht = text(0,0,sprintf('t = %d',t(tidx)));
set(ht,'horizontalalignment','center','rotation',90,'units','normalized', ...
'position',[-0.2 0.5],'fontweight','bold','fontsize',fontsize);
end
if tidx == 1
ht = text(0,0,setnames{setidx});
set(ht,'horizontalalignment','center','rotation',0,'units','normalized', ...
'position',[0.5 1.15],'fontweight','bold','fontsize',fontsize);
end
end
end
That said, none of those options are present in my version, and they don't work in the forum editor either. I have no means to provide you with a tested solution. Take this as a conceptual suggestion. You'll probably have to move the labels around and play with the font size to get things to fit.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!