Combining legend data ?
古いコメントを表示
i have problem in the legend , i have 2 entries in the legend (1 circles, 1 line) but in figure show the 2 entries as line
i like to IGA be in line and Ansys in circle

yyyy=[0 0.01 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 ...
0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 ...
0.88 0.9 0.92 0.94 0.96 0.98 1];
dd1=[0 0.005447201 0.009575025 0.016551865 0.022614992 0.028075864 0.03310134 0.03780359 0.042250013 0.046489493 0.050549191 0.05445774 ...
0.058227435 0.061883022 0.065425744 0.068871215 0.072228082 0.07549987 0.078696851 0.081822716 0.084881865 0.087873391 ...
0.090814743 0.093691218 0.096521905 0.099298382 0.102032762 0.104717148 0.107358176 0.109955379 0.112514798 0.115041301 ...
0.117521333 0.119968992 0.122383109 0.124769114 0.127113605 0.129436671 0.1317237 0.133982038 0.136211393 0.138411786 ...
0.140589391 0.142737112 0.144861765 0.146962653 0.149033501 0.151087595 0.153117208 0.155122654 0.157104297 0.159068454 ];
dd2=[0 0.035389897 0.045726344 0.058921381 0.068374073 0.076022255 0.082550687 0.08831281 0.093508902 0.098270711 ...
0.102679553 0.106802674 0.110679771 0.114356452 0.11784968 0.121187409 0.124388034 0.127463176 0.130429327 0.133295613 ...
0.13607092 0.138758586 0.141377844 0.143918667 0.14640063 0.148818688 0.15118548 0.153495995 0.155757577 0.157971273 ...
0.160143552 0.162279758 0.164369433 0.166425409 0.168447591 0.170441367 0.172396181 0.174329489 0.176229718 0.178103486 ...
0.179951052 0.181772877 0.183574543 0.185350548 0.187106892 0.188843367 0.190555012 0.192253152 0.193931702 0.195591118 ...
0.197231883 0.198859494];
dd3=[0 0.024865607 0.031671664 0.040222179 0.046293945 0.051198152 0.05537549 0.05905213 0.062357647 0.065378091 ...
0.068167182 0.070769214 0.073210702 0.075521461 0.077713084 0.079803848 0.081805843 0.083726819 0.085577454 0.087363742 ...
0.089091474 0.090762963 0.092390306 0.093967434 0.095506607 0.097004791 0.098469889 0.099898869 0.101296344 0.102663017 ...
0.104002919 0.105319358 0.10660594 0.107870604 0.109113305 0.110337359 0.111536318 0.112720903 0.113884031 0.115029781 ...
0.116158323 0.117269957 0.118368093 0.119449388 0.120517509 0.121572332 0.122610863 0.123639983 0.124656001 0.125659208 ...
0.126649912 0.127631439 ];
figure;
hold on;
xlim([0 1]); ylim([0 0.2]);
qmax=[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
u_22=[0 0.084 0.106 0.124 0.138 0.15 0.16 0.17 0.18 0.19 0.198];
u_11=[0 0.057 0.07 0.08 0.09 0.097 0.103 0.11 0.115 0.12 0.125];
psi=[0 0.035 0.056 0.073 0.089 0.102 0.114 0.125 0.136 0.146 0.157];
plot(yyyy,dd1,'-b',yyyy,dd2,'-k',yyyy,dd3,'-r')
plot(qmax,u_11,'ro' ,qmax,u_22,'ko',qmax,psi,'bo')
gtext({'$ u_2/L $'},'interpreter','latex','FontSize',12)
gtext({'$\frac {-10 u_1}{L}$'},'interpreter','latex','FontSize',12)
gtext({'$\frac {\psi}{\pi}$'},'interpreter','latex' ,'FontSize',12)
legend('IGA', 'Ansys','Location', 'northwest');
Does anybody know how to do this?
回答 (1 件)
Davide Masiello
2023 年 7 月 31 日
編集済み: Davide Masiello
2023 年 7 月 31 日
Here's an example with made up functions (your code was too slow on the browser).
Is this what you're looking for?
y = linspace(0,1,100);
f1 = y;
f2 = 2*y;
f3 = 3*y;
y0 = y(1:10:end);
p1 = y0;
p2 = 2*y0;
p3 = 3*y0;
A = plot(y,f1,'-b',y,f2,'-k',y,f3,'-r'); hold on
B = plot(y0,p1,'bo',y0,p2,'ko',y0,p3,'ro');
legend([A(1) B(1)],{'IGA','Ansys'},'Location','northwest')
カテゴリ
ヘルプ センター および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
