- Try semilogy
- Try legend
How can I make multiple lines on a graph more spaced apart?
조회 수: 5 (최근 30일)
이전 댓글 표시
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')
댓글 수: 0
답변 (1개)
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')
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!