Adding legend for iteration and if condition graph
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Good day, I currently having problem in insert the legend to a graph. Basically this is my coding in plotting the graph. I am using the DisplayName but the legend is missing also. Is it any other ways to put the legend into my plot?
title('Graph of behaviour against iteration');
xlabel('iteration t');
ylabel('behaviour value');
if max_euc_dist<0.056
plot(i,dataCopyS5(i,:),'g.','MarkerSize',4,'DisplayName','Normal');hold on
else
plot(i,dataCopyS5(i,:),'m+','MarkerSize',4,'DisplayName','Anomaly');hold on
end
The graph cannot change to scatter plot as the size of dataCopyS5 is 1000x8. Hope that my problem faced can be solved. Thank you.
0 Kommentare
Antworten (1)
jonas
am 26 Mai 2018
Try this,
title('Graph of behaviour against iteration');
xlabel('iteration t');
ylabel('behaviour value');
if max_euc_dist<0.056
h1=plot(i,dataCopyS5(i,:),'g.','MarkerSize',4);hold on
else
h2=plot(i,dataCopyS5(i,:),'m+','MarkerSize',4);hold on
end
legend([h1 h2],'Normal','Anomaly')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Legend 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!