Page 1 of 1

Hide some legends in graph plot

Posted: Mon Dec 23, 2024 6:16 am
by amh

Code: Select all

figure(1);
hold on;
l1 = plot(1:10);
l2 = plot(2:2:20);
l3 = plot(3:3:30);

Code: Select all

legend([l1,l3],'Line-1','Line-3') % This will show legend for l1 & l3 only
source: Matlab Forum