How can I make multiple lines on a graph more spaced apart?

조회 수: 2 (최근 30일)
AAK
AAK 2021년 8월 9일
댓글: AAK 2021년 8월 12일
I have to put 4 lines on the same graph but they overlap and are hard to see clearly. Is there anyway to make them more spaced out or stretch the axes so that they can be seen better?
figure
errorbar(K20conc,K20int1,K20errx,K20erry,'rx','MarkerSize',5,'CapSize',12,...
'Linestyle','none', 'HandleVisibility','off') ;
hold on
K20line = polyfit(K20conc, K20int1,1);
K20fit = polyval(K20line,K20conc);
plot(K20conc,K20fit,'k-','DisplayName','2020 - K 766.491')
hold on
errorbar(K20conc,K20int2,K20errx,K20erry2,'kx','MarkerSize',5,'CapSize',12,...
'Linestyle','none', 'HandleVisibility','off') ;
hold on
K20line2 = polyfit(K20conc, K20int2,1);
K20fit2 = polyval(K20line2,K20conc);
plot(K20conc,K20fit2,'g-','DisplayName','2020 - K 769.897')
errorbar(K21conc,K21int1,K21errx,K21erry,'gx','MarkerSize',5,'CapSize',12,...
'Linestyle','none', 'HandleVisibility','off') ;
hold on
K21line = polyfit(K21conc, K21int1,1);
K21fit = polyval(K21line,K21conc);
plot(K21conc,K21fit,'b-','DisplayName','2021 - K 766.491')
hold on
errorbar(K21conc,K21int2,K21errx,K21erry2,'bx','MarkerSize',5,'CapSize',12,...
'Linestyle','none', 'HandleVisibility','off') ;
hold on
K21line2 = polyfit(K21conc, K21int2,1);
K21fit2 = polyval(K21line2,K21conc);
plot(K21conc,K21fit2,'c-','DisplayName','2021 - K 769.897')

답변 (1개)

darova
darova 2021년 8월 11일
t = 0:0.1:10;
plot(t,sin(t),'.r')
line(t,sin(t))
line(t,cos(t),'marker','.','color','g')
line(t,cos(t),'color', 'm')
legend('curve1','curvw2', 'curve3','curve4')
  댓글 수: 1
AAK
AAK 2021년 8월 12일
Thanks so much for your help but unfortunately the lines have to be straight and not curved.

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

카테고리

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