Help using tiledlayout and nexttile functions
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Angel Lozada
am 8 Jul. 2023
Bearbeitet: the cyclist
am 19 Jul. 2023
Hello.
I will really be appreciated if someone could help me with the follow inquiry:
I am trying to plot several subplots using tiledlayout and nexttile functions, however I am not getting the final plot as I would like (i.e., 8-by-2 tiled chart layout).
I had read https://www.mathworks.com/help/matlab/ref/tiledlayout.html and https://www.mathworks.com/help/matlab/ref/nexttile.html to learn more about these functions.
Any help is more than welcome.
Regards.
clear;
data = readmatrix('Data2');
T = data(:,1);
T = seconds(data(:,1));
T.Format = 'hh:mm';
T3 = data(:,3);
T4 = data(:,4);
T5 = data(:,5);
T6 = data(:,6);
T7 = data(:,7);
T8 = data(:,8);
T9 = data(:,9);
T10 = data(:,10);
T11 = data(:,11);
T12 = data(:,12);
T13 = data(:,13);
T14 = data(:,14);
T15 = data(:,15);
T16 = data(:,16);
tiledlayout(8,2);
nexttile
%figure; % Place "figure" in this section allow to plot this data in a separate window.
plot (T,T3,'x');
title 'Emitted Signal from NAA Station';
ylabel ('Phase');
xlabel ('Samples');
nexttile
%figure;
plot (T,T4,'x');
title 'Emitted Signal from NAA Station';
ylabel ('Apmlitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T5,'x');
title 'Emitted Signal from NLK Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T6,'x');
title 'Emitted Signal from NLK Station';
ylabel ('Amplitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T7,'x');
title 'Emitted Signal from NDK Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T8,'x');
title 'Emitted Signal from NDK Station';
ylabel ('Amplitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T9,'x');
title 'Emitted Signal from NWC Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T10,'x');
title 'Emitted Signal from NWC Station';
ylabel ('Amplitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T11,'x');
title 'Emitted Signal from NPM Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T12,'x');
title 'Emitted Signal from NPM Station';
ylabel ('Amplitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T13,'x');
title 'Emitted Signal from NPM II Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T14,'x');
title 'Emitted Signal from NPM II Station';
ylabel ('Amplitude');
xlabel ('Samples');
% figure;
nexttile
plot (T,T15,'x');
title 'Emitted Signal from NAU Station';
ylabel ('Phase');
xlabel ('Samples');
% figure;
nexttile
plot (T,T16,'x');
title 'Emitted Signal from NAu Station';
ylabel ('Amplitude');
xlabel ('Samples');
Regards.
0 Kommentare
Akzeptierte Antwort
the cyclist
am 8 Jul. 2023
It's unclear to me what you are expecting to get, but this code works exactly as I would expect.
You have defined an 8x2 grid of plots, but you have only actually called nexttile/plot 14 times. Therefore, you fill in the first 14 subplot slots (in the default order, which is row-major). The last 2 slots are empty.
4 Kommentare
the cyclist
am 10 Jul. 2023
Bearbeitet: the cyclist
am 19 Jul. 2023
It will help to use compact tile spacing and padding. Call tiledlayout with a handle:
t = tiledlayout(7,2);
and then run
t.TileSpacing = 'compact';
t.Padding = 'compact';
This will reduce the white space. Other than that, I'm not sure there is much more you can do to make the subplots larger.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!