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!