Why are some plot figures not showing all lines?
Afficher commentaires plus anciens
Hi all,
I am plotting different data sets on 4 seperate figures. Each graph should have 9 lines of data and one 'xline'. Figures 1 and 3 work just fine, but figure 2 and 4 do not plot 3 of the 9 lines, namely the ones for the "Vulcan 4.2" types, the blue lines. I do not get any errors or anything and the code for each figure is basically the same, except for the data they are using. When looking at the variables, I can also not see any problem. FYI I use a random 'x' from one of the data sets, since these are the exact same for each one. Does anybody know what might be the reason and how to solve this? Thank you.
I attached the code, raw data and the output of the figures.
clear
close all
clc
%% reading/loading csv files
% Vulcan
% TOF 1.1
Vulcan111 = readmatrix("20230707_Vulcan 1.1_1.csv");
Vulcan112 = readmatrix("20230707_Vulcan 1.1_2.csv");
Vulcan113 = readmatrix("20230707_Vulcan 1.1_3.csv");
Vulcan1_1R1 = Vulcan111(:,2);
Vulcan1_1I1 = Vulcan111(:,3);
Vulcan1_1R2 = Vulcan112(:,2);
Vulcan1_1I2 = Vulcan112(:,3);
Vulcan1_1R3 = Vulcan113(:,2);
Vulcan1_1I3 = Vulcan113(:,3);
% TOF 4.2
Vulcan421 = readmatrix("20230707_Conductex 4.2_1.csv");
Vulcan422 = readmatrix("20230707_Conductex 4.2_2.csv");
Vulcan423 = readmatrix("20230707_Conductex 4.2_3.csv");
Vulcan4_2R1 = Vulcan421(:,2);
Vulcan4_2I1 = Vulcan421(:,3);
Vulcan4_2R2 = Vulcan422(:,2);
Vulcan4_2I2 = Vulcan422(:,3);
Vulcan4_2R3 = Vulcan423(:,2);
Vulcan4_2I3 = Vulcan423(:,3);
% Conductex
% TOF 1.1
Conductex111 = readmatrix("20230707_Conductex 1.1_1.csv");
Conductex112 = readmatrix("20230707_Conductex 1.1_2.csv");
Conductex113 = readmatrix("20230707_Conductex 1.1_3.csv");
Conductex1_1R1 = Conductex111(:,2);
Conductex1_1I1 = Conductex111(:,3);
Conductex1_1R2 = Conductex112(:,2);
Conductex1_1I2 = Conductex112(:,3);
Conductex1_1R3 = Conductex113(:,2);
Conductex1_1I3 = Conductex113(:,3);
% TOF 4.2
Conductex421 = readmatrix("20230707_Conductex 4.2_1.csv");
Conductex422 = readmatrix("20230707_Conductex 4.2_2.csv");
Conductex423 = readmatrix("20230707_Conductex 4.2_3.csv");
Conductex4_2R1 = Conductex421(:,2);
Conductex4_2I1 = Conductex421(:,3);
Conductex4_2R2 = Conductex422(:,2);
Conductex4_2I2 = Conductex422(:,3);
Conductex4_2R3 = Conductex423(:,2);
Conductex4_2I3 = Conductex423(:,3);
% Printex Kappa
% TOF 1.1
Printex111 = readmatrix("20230707_Printex Kappa 1.1_1.csv");
Printex112 = readmatrix("20230707_Printex Kappa 1.1_2.csv");
Printex113 = readmatrix("20230707_Printex Kappa 1.1_3.csv");
Printex1_1R1 = Printex111(:,2);
Printex1_1I1 = Printex111(:,3);
Printex1_1R2 = Printex112(:,2);
Printex1_1I2 = Printex112(:,3);
Printex1_1R3 = Printex113(:,2);
Printex1_1I3 = Printex113(:,3);
% TOF 4.2
Printex421 = readmatrix("20230707_Printex Kappa 4.2_1.csv");
Printex422 = readmatrix("20230707_Printex Kappa 4.2_2.csv");
Printex423 = readmatrix("20230707_Printex Kappa 4.2_3.csv");
Printex4_2R1 = Printex421(:,2);
Printex4_2I1 = Printex421(:,3);
Printex4_2R2 = Printex422(:,2);
Printex4_2I2 = Printex422(:,3);
Printex4_2R3 = Printex423(:,2);
Printex4_2I3 = Printex423(:,3);
x = Printex111(:,1);
%% Plot real Er TOF1.1
figure(1)
hold on
% plot Vulcan TOF1.1 real eps
plot(x,Vulcan1_1R1,'color', [0 0 1]);
plot(x,Vulcan1_1R2,'color', [0 0.5 1]);
plot(x,Vulcan1_1R3,'color', [0 1 1]);
% plot Conductex TOF1.1 real eps
plot(x,Conductex1_1R1,'color', [0 1 0]);
plot(x,Conductex1_1R2,'color', [0.5 1 0]);
plot(x,Conductex1_1R3,'color', [1 1 0]);
% plot Printex Kappa TOF1.1 real eps
plot(x,Printex1_1R1,'color', [1 0 0]);
plot(x,Printex1_1R2,'color', [1 0 0.5]);
plot(x,Printex1_1R3,'color', [1 0 1]);
% tabel formatteren
title('Er_r TOF1.1');
xlabel('GHz');
ylabel('Er_r');
legend('Vulcan1', 'Vulcan2','Vulcan3','Conductex1','Conductex2','Conductex3','Printex Kappa1','Printex Kappa2','Printex Kappa3');
xline(0.1,'LineStyle',':','DisplayName','0.1 GHZ');
hold off
%% Plot real Er TOF4.2
figure(2)
hold on
% plot Vulcan TOF4.2 real eps
plot(x,Vulcan4_2R1,'color', [0 0 1]);
plot(x,Vulcan4_2R2,'color', [0 0.5 1]);
plot(x,Vulcan4_2R3,'color', [0 1 1]);
% plot Conductex TOF4.2 real eps
plot(x,Conductex4_2R1,'color', [0 1 0]);
plot(x,Conductex4_2R2,'color', [0.5 1 0]);
plot(x,Conductex4_2R3,'color', [1 1 0]);
% plot Printex Kappa TOF4.2 real eps
plot(x,Printex4_2R1,'color', [1 0 0]);
plot(x,Printex4_2R2,'color', [1 0 0.5]);
plot(x,Printex4_2R3,'color', [1 0 1]);
% tabel formatteren
title('Er_r TOF4.2');
xlabel('GHz');
ylabel('Er_r');
legend('Vulcan1', 'Vulcan2','Vulcan3','Conductex1','Conductex2','Conductex3','Printex Kappa1','Printex Kappa2','Printex Kappa3');
xline(0.1,'LineStyle',':','DisplayName','0.1 GHZ');
hold off
%% Plot imaginary Er TOF1.1
figure(3)
hold on
% plot Vulcan TOF1.1 imag eps
plot(x,Vulcan1_1I1,'color', [0 0 1]);
plot(x,Vulcan1_1I2,'color', [0 0.5 1]);
plot(x,Vulcan1_1I3,'color', [0 1 1]);
% plot Conductex TOF1.1 imag eps
plot(x,Conductex1_1I1,'color', [0 1 0]);
plot(x,Conductex1_1I2,'color', [0.5 1 0]);
plot(x,Conductex1_1I3,'color', [1 1 0]);
% plot Printex Kappa TOF1.1 imag eps
plot(x,Printex1_1I1,'color', [1 0 0]);
plot(x,Printex1_1I2,'color', [1 0 0.5]);
plot(x,Printex1_1I3,'color', [1 0 1]);
%tabel formatteren
title('Er_i TOF1.1');
xlabel('GHz');
ylabel('Er_i');
legend('Vulcan1', 'Vulcan2','Vulcan3','Conductex1','Conductex2','Conductex3','Printex Kappa1','Printex Kappa2','Printex Kappa3');
xline(0.1,'LineStyle',':','DisplayName','0.1 GHZ');
hold off
%% Plot imaginary Er TOF4.2
figure(4)
hold on
% plot Vulcan TOF4.2 imag eps
plot(x,Vulcan4_2I1,'color', [0 0 1]);
plot(x,Vulcan4_2I2,'color', [0 0.5 1]);
plot(x,Vulcan4_2I3,'color', [0 1 1]);
% plot Conductex TOF4.2 imag eps
plot(x,Conductex4_2I1,'color', [0 1 0]);
plot(x,Conductex4_2I2,'color', [0.5 1 0]);
plot(x,Conductex4_2I3,'color', [1 1 0]);
% plot Printex Kappa TOF4.2 imag eps
plot(x,Printex4_2I1,'color', [1 0 0]);
plot(x,Printex4_2I2,'color', [1 0 0.5]);
plot(x,Printex4_2I3,'color', [1 0 1]);
%tabel formatteren
title('Er_i TOF4.2');
xlabel('GHz');
ylabel('Er_i');
legend('Vulcan1', 'Vulcan2','Vulcan3','Conductex1','Conductex2','Conductex3','Printex Kappa1','Printex Kappa2','Printex Kappa3');
xline(0.1,'LineStyle',':','DisplayName','0.1 GHZ');
hold off

1 commentaire
Stephen23
le 10 Juil 2023
"Figures 1 and 3 work just fine, but figure 2 and 4 do not plot 3 of the 9 lines"
How are you checking this? Simply looking at a figure does not tell you how many lines are plotted on it, e.g. it will not show you if there are lines hinding under other lines, or lines with (non-plotted) NaN data. You need to check the plot objects themselves, e.g. the number of axes children or the size of the X and Y data.
For a start, show us how many children those axes have.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!