Hello!
I am looking to change the legend color and am using the following snippet of code:
x = 0:10; y1 = 5*x; % Line 1
y2 = 5*x + 5; % Line 2
fig = fig + 1; figure(fig); plot(x,y1,'k'), hold on plot(x,y2,'b'), hold onhleg = legend('Line 1','Line 2')hlegline = findobj(hleg,'Type','Line')set(hlegline(2), 'Color', 'g');set(hlegline(4), 'Color', 'r');
As you can see, I am using objects 2 and 4. My question is, what do objects 1 and 3 represent, i.e. hlegline(1) and hlegline(3), respectively? I haven't been able to detect the difference nor find the answer online.
Thank you for your help!
Best Answer