Lines in plot overlaying axis
이전 댓글 표시
Hey together,
I have the following code:
maxDisp = 0;
nPoints = 21;
nEntries = 12;
formatIn = 'dd.mm.yyyy';
cc = jet(nPoints);
figure('Name','Test','NumberTitle','off');
for i = 1:nPoints
hold on
errorbar(MP{i}(:,1),[0; MP{i}(2:end,12)]/10,...
[0; MP{i}(2:end,nEntries + 1)]/10,'color',cc(i,:))
if max(MP{i}(:,12)) > maxDisp
maxDisp = max(MP{i}(:,12));
end
end
grid on
datetick('x',formatIn)
xticks(axisTicks(1:2:end));
xticklabels(datestr(axisTicks(1:2:end),formatIn))
xtickangle(45)
axis([datenum("01.01.1989",formatIn) today 0 75])
giving me the image:

I'd like to get the lines stopping at the axis (so not to overlay the axis). But I can't find a way to do so. Anyone knowing how to get the things to look proper?
Find the matrices needed attached.
As Alex Mcaulley mentions it seems to be an issues only appearing within some versions of Matlab, mine is R2018a.
댓글 수: 1
Alex Sune
2019년 5월 31일
Your code works as you want in my release (R2016b)

답변 (1개)
Star Strider
2019년 5월 31일
Try this:
set(gca, 'Clipping','on')
댓글 수: 2
Andreas Zaugg
2019년 5월 31일
Star Strider
2019년 5월 31일
What MATLAB version (release) are you using?
It’s probably worthwhile to ask MathWorks to see if an easier option exists. (Use the Contact Us (telephone handset icon) link in the upper right corner of this page.) If so, post the MathWorks solution as a separate Answer. I will then delete my Answer, since it didn’t solve your problem.
카테고리
도움말 센터 및 File Exchange에서 Errorbars에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!