I need your help to add a legend to a graph showing two functions labels with different colors
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!