How to transfer a figure with all of its components to a subplot
Ältere Kommentare anzeigen
Hello there, community.
I have a graphic that I create on a regular basis for various purposes and data analysis.
Issue-1
I'd like to display Pixel Information for each subplot, but it appears that I'm only getting the last subplot to do so, rather than each subplot displaying Pixel Information.
Issue-2 (suggestion)
At the same time, I disagree with having an additional main figure fig1 in my instance and instead only getting the subplots with Pixel Information.
Could you please give your ideas on how to do it?
Here is the test code which is not working as per the expectation
fig1 = figure;
ax = axes('parent',fig1);
imgdiff = rand(90,120);
h=imshow(imgdiff,[]);
xlabel(ax,'x');
ylabel(ax,'y');
title(ax,'source');
fig2 = figure;
%subplot-1
ax1 = subplot(2,2,1,'parent',fig2);
h1 = imagesc(imgdiff);
title('imgdiff'); axis on;
hText = impixelinfoval(fig2,h1);set(hText,"FontWeight","bold");set(hText,"FontSize",10);
%subplot-2
ax2 = subplot(2,2,2,'parent',fig2);
h2 = imagesc(medfilt2(imgdiff));
title('medfilt2'); axis on;
hText = impixelinfoval(fig2,h2);
set(hText,"FontWeight","bold");set(hText,"FontSize",10);
%subplot-3
ax3 = subplot(2,2,3,'parent',fig2);
h3 = imagesc(wiener2(imgdiff));
title('wiener2'); axis on;
hText = impixelinfoval(fig2,h3);
set(hText,"FontWeight","bold");set(hText,"FontSize",10);
%subplot-4
ax4 = subplot(2,2,4,'parent',fig2);
h4 = imagesc(entropyfilt(imgdiff));
title('entropyfilt'); axis on;
hText = impixelinfoval(fig2,h4);set(hText,"FontWeight","bold");set(hText,"FontSize",10);
axcp = copyobj(ax, fig2);
set(axcp,'Position',get(ax1,'position'));
delete(ax1);% not sure to do or not ??
%delete(ax2);
%delete(ax3);
%delete(ax4);
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Subplots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


