Identifying a line in multiple plots
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Charles Mitchell-Thurston
am 10 Jun. 2022
Bearbeitet: Charles Mitchell-Thurston
am 10 Jun. 2022
I have code that plots all of my data as random colours and it works perfectly.
for t = 1:20
tempY = Sim_Graphs_Y{t,1};
txt = [num2str(t)];
plot(NewX,tempY,'Color',rand(1,3),'LineStyle','--','DisplayName',txt);
hold on
end
plot(NewX,ygraph1,'Color','r','LineStyle','-','DisplayName','Exp');
legend
savefig('weightingTEST.fig')

Is there a better way for me to be able to work out which line is which outside of just trying to match the colour as best i can?
0 Kommentare
Akzeptierte Antwort
Kevin Holly
am 10 Jun. 2022
I made the app attached with App Designer. You could make a similar app to help you identify the selected lines. You can change the lines within the startup function.
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 10 Jun. 2022
Not sure what that means. You can set a breakpoint on the plot line and see each curve right when it's plotted.
If you want you can, with sprintf(), create a cell array of strings inside the loop that describes the parameters of each curve and then give that cell array to legend()
2 Kommentare
Image Analyst
am 10 Jun. 2022
Not sure what "closed" means. To find the closest, compute the mean absolute deviation. There is a function mad
or
theMAD(t) = mean(abs(curve - redCurve));
and look for the min value
[minMad, indexOfMinMad] = min(theMAD)
Siehe auch
Kategorien
Mehr zu Annotations 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!