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!