MATLAB Answers

How do we concatenate two imagesc figures ( 2D matrix) into one figure ( one below the other stacked) without any gaps?

31 views (last 30 days)
Nini
Nini on 15 Sep 2021
Commented: Nini on 21 Sep 2021 at 10:01
I have two figures (Fig1 and Fig2): They are two separate imagesc plots.
How do i get a plot of concatenated version of these two plots as shown in concatenated.png( attached) ?
There should not be any gaps between the two plots as we obain in subplot.
code:
figure(4);
imagesc(Rng,Vel,RDM_1);
xlabel('---> Range (m)');ylabel('---> Velocity (m/s)')
title('Range-Doppler Map 1');
figure(5);
imagesc(Rng,Vel,RDM_2);
xlabel('---> Range (m)');ylabel('---> Velocity (m/s)')
title('Range-Doppler Map 2');
I need to concatenate the 2D matrix RDM_1 and RDM_2 one below the other without any gap ( as shown in concatenate.png).
  4 Comments

Sign in to comment.

Accepted Answer

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair on 21 Sep 2021 at 7:25
I understand that you are trying to have two 'imagesc' plots stacked vertically, without any gap in between them.
A Possible workaround for this would be to have two 'axes' object defined on the same 'figure' handle , positioned in such a way that they are stacked vertically without any gap in between.
This can be done by adjusting the 'Position' property of the axes object.You can refer to the following code for the same.
fig=figure;
axes1=axes(fig);
axes2=axes(fig);
axes1.Position(1,4)=axes1.Position(1,4)/2;
axes2.Position(1,4)=axes2.Position(1,4)/2;
axes2.Position(1,2)= axes1.Position(1,2)+axes1.Position(1,4);
imagesc(axes1,Rng,Vel,RDM_1);
imagesc(axes2,Rng,Vel,RDM_2);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by