Does anybody know how to include a legend in a figure of three functions with different colours or patterns?
古いコメントを表示
Hi, I am plotting three functions at the same time in order to compare them and I would like to include a legend in this graphic, to represent the color and correspondet name of each function. Does anybody know how to do it?
plot(t,x1,'r'); hold on; plot(t,x2,b--o'); hold on plot(t,x3,g--');
Thank you!!!
title('Comparison'); xlabel('Time'); ylabel('f(t)');
subplot(132); plot(t1,x_rec_vel(:,2),'r'); hold on; plot(t1,Y(1:end-1,5),'b--o'); title('Velocity Mass 2'); xlabel('Time'); ylabel('v(t)');
subplot(133); plot(t1,x_rec_vel(:,3),'r'); hold on; plot(t1,Y(1:end-1,6),'b--o'); title('Velocity Mass 3'); xlabel('Time'); ylabel('v(t)');
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!