How to reduce space between plots in subplot?

20 visualizzazioni (ultimi 30 giorni)
Jamie Al
Jamie Al il 20 Gen 2023
Risposto: KSSV il 20 Gen 2023
How can I reduce the space between my plots? Here's my code:
Lx = 640;
Ly = 640;
Lz = 640;
E3d=(readmatrix('...txt'));
E2d=(readmatrix('...txt'));
time3Col = (readmatrix('...txt'));
time2Col = (readmatrix('...txt'));
fontSize = 16;
f = figure();
subplot(1,3,1)
semilogy(time3Col, (E3d)/(Lx*Ly*Lz),'LineWidth',2,'DisplayName','E');
hold on;
semilogy(time2Col, (E2d)/(Lx*Ly),'LineWidth',2,'DisplayName','E');
grid on;
ylabel('Energy (J)');
E3dC=(readmatrix('...txt'));
E2dC=(readmatrix('...txt'));
time3C = (readmatrix('...txt'));
time2C = (readmatrix('...txt'));
subplot(1,3,2)
semilogy(time3C, (E3dC)/(Lx*Ly*Lz),'LineWidth',2,'DisplayName','E');
hold on;
semilogy(time2C, (E2dC)/(Lx*Ly),'LineWidth',2,'DisplayName','E');
grid on;
yticklabels('');
xlabel('time (s)');
E3dI=(readmatrix('...txt'));
E2dI=(readmatrix('...txt'));
time3In = (readmatrix('...txt'));
time2In = (readmatrix('...txt'));
subplot(1,3,3)
semilogy(time3In, (E3dI)/(Lx*Ly*Lz),'LineWidth',2,'DisplayName','E');
hold on;
semilogy(time2In, (E2dI)/(Lx*Ly),'LineWidth',2,'DisplayName','E');
grid on;
yticklabels('');
What I get something like this:
But the space between plots is so large.

Risposta accettata

KSSV
KSSV il 20 Gen 2023
You may also have a look on tiledlayout.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by