How to customize Legends?

24 ビュー (過去 30 日間)
JPS
JPS 2020 年 10 月 23 日
コメント済み: JPS 2020 年 10 月 23 日
figure
plot(1 , theta_tip_analytical_c1 , 'ro')
hold on
plot(2 , theta_tip_analytical_c2 , 'ro')
plot(3 , theta20g , 'ro')
plot(4 , theta_tip_analytical_c4 , 'ro')
xlabel('case no')
ylabel('theta tip')
title('Theta Tip Comparison')
%legend('analytical theta tip')
plot(1 , theta_tip_numerical_c1 , 'bx')
plot(2 , theta_tip_numerical_c2 , 'bx')
plot(3 , theta20n_c3 , 'bx')
plot(4 , theta_tip_numerical_c4 , 'bx')
legend('analytical theta tip' , 'numerical theta tip')
hold off
I want to name all those points plotted in 'ro' format as legend1 and all those points plotted in 'bx' format as legend2. How to do it?

採用された回答

VBBV
VBBV 2020 年 10 月 23 日
編集済み: VBBV 2020 年 10 月 23 日
Try this.. use handle structure as below
figure
p1 = plot(datax1,datay1 , 'ro')
hold on
plot(datax2,datay2, 'ro')
plot(datax3,datay3 , 'ro')
plot(datax4,datay4 , 'ro')
xlabel('case no')
ylabel('theta tip')
title('Theta Tip Comparison')
%legend('analytical theta tip')
p2 = plot(datax5,datay5, 'bx')
plot(datax6,datay6, 'bx')
plot(datax7,datay7, 'bx')
plot(datax8,datay8, 'bx')
legend([p1 p2],{'analytical theta tip' , 'numerical theta tip'})
hold off
  1 件のコメント
JPS
JPS 2020 年 10 月 23 日
thanks a lot man! it works...

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by