I need your help to add a legend to a graph showing two functions labels with different colors
1 view (last 30 days)
Show older comments
When I ran the following code in Command Window, I get a legend but with only blue color for e1 and e2 functions. In other words, the plot command specifies a blue line of circles ('-bo') for the e1 function and AGAIN a blue line of circles ('-go') for the e2 function, instead of a GREEN one. Can you please help to get this corrected so that ('-bo') gives blue and ('-go') gives green, in the legend box ?
x = 0:1:10;
e1 = olivier(x);
e2 = olivier(x);
figure
plot(x,e1,'-bo',x,e2,'-go')
title('Graph of round-off error e1 and e2 between 0:1:10')
xlabel('0 < x < 10')
ylabel('round-off error values')
legend('e1 = olivier(x)','e2 = olivier(x)')
0 Comments
Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!