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

6 ビュー (過去 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 Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by