- Try semilogy
- Try legend
How can I make multiple lines on a graph more spaced apart?
6 次查看(过去 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!