Could anyone help me how to generate the following legend.

조회 수: 1 (최근 30일)
jaah navi
jaah navi 2021년 8월 8일
댓글: jaah navi 2021년 8월 8일
I want to have the legend as
* A o B
^ C > D
- E -- F
Could anyone please help me on this.
  댓글 수: 1
KSSV
KSSV 2021년 8월 8일
You have not acknowledged your previous questions which were answered. You have asked many very simple questions, instead you could read the documentation.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2021년 8월 8일
str = {'* A o B', '^ C > D', ' - E -- F'} ;
A = rand(10,3) ;
plot(A)
legend(str)
  댓글 수: 1
jaah navi
jaah navi 2021년 8월 8일
I am a having a matlab code
x=1:10
y1=rand(1,10)
y2=rand(1,10)
y3=rand(1,10)
y4=rand(1,10)
figure(1)
[hAX,hLine1,hLine2] = plotyy(x, [y1; y3], x, [y2; y4], @(X,Y)semilogy(X,Y), @(X,Y)plot(X,Y));
set(hLine1(1),'LineStyle','-','Marker','*', 'Color', 'r');
set(hLine1(2),'LineStyle','-','Marker','o', 'Color', 'b');
set(hLine2(1),'LineStyle','--','Marker','*', 'Color', 'r');
set(hLine2(2),'LineStyle','--','Marker','o', 'Color', 'b');
set(gca,'XTick',[1:1:10])
xlabel('persons')
ylabel(hAX(1),'weight') % left y-axis
ylabel(hAX(2),'height') % right y-axis
grid on;
lgd=columnlegend(2,{'Batch 1','Batch 2 ','Batch 1','Batch 2'})
when I run the code i am getting the legend in the graph as follows
But actually i want 'Batch 1','Batch 2 ' to be displayed once with markers alone followed by solid line mentioning weights and dotted line mentioning heights.
Could you please help me on this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by