Semilog plotting in loop
Mostrar comentarios más antiguos
Hello,
I want to plot my data set on a semiy log plot according to 4 different legend categories, and I want the points of each series to be connected by a dashed line.
I am able to plot all the points with the looping below, but the lines connecting each serie are for some reason not coming out on the plot.
Any help would be appreciated, thank you!
[NUM_w,TXT_w,RAW_w] = xlsread("wells");
MATLABDate = NUM_w(1,1:9) + 693960 % convert from excel # dates to MATLAB # dates
dates = datetime(MATLABDate,'ConvertFrom','datenum') % convert dates to day-month-year format
values_w = NaN(14,9);
for i = 2:14
for j = 1:9
if NUM_w(i,j) > 0
values_w(i,j) = NUM_w(i,j)
elseif NUM_w(i,j) == 0
values_w(i,j) = 0.0001 % well matrix for ND ratios
end
end
end
m=10
for i = 2:14
% if statements here to plot accordingly to well attribute: type and plugging status
if TXT_w(i+1,11) == "Plugged" % Plugged | filled circle
if TXT_w(i+1, 12) == "Gas" % Plugged, Gas | blue filled circle
semilogy(dates,values_w(i,1:9),'--ob','MarkerFaceColor','b','MarkerSize',m); hold on
else % Plugged, Non Gas | red filled circle
semilogy(dates,values_w(i,1:9),'--or','MarkerFaceColor','r','MarkerSize',m); hold on
end
else % Unplugged | outline circle
if TXT_w(i+1, 12) == "Gas" % Unplugged, Gas | blue outline circle
semilogy(dates,values_w(i,1:9),'--ob','MarkerSize',m); hold on
else % Unplugged, Non Gas | red outline circle
semilogy(dates,values_w(i,1:9),'--or','MarkerSize',m); hold on
end
end
xlim([datetime(41275+693960,'ConvertFrom','datenum'),datetime(44197+693960,'ConvertFrom','datenum')]); % set x axis scale
ylim([10^-5,2*10^0]); % set y axis scale
end
2 comentarios
Dyuman Joshi
el 22 de Jun. de 2023
You are trying to access 11th and 12th column of TXT_w, which only has 2 columns, so you might want to adjust the indices (which are based on the excel data).
Similarly, there are 14 rows of each data, and you are trying to access the 15th row, which is not possible.
Do you want club all the points together for pairs? Such as plot all the points for "Plugged" and "Gas" together on a single line? Or do you want plot for each row individually?
Marguerite Lorenzo
el 22 de Jun. de 2023
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

