Lines in plot overlaying axis
Mostrar comentarios más antiguos
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 comentario
Alex Sune
el 31 de Mayo de 2019
Your code works as you want in my release (R2016b)

Respuestas (1)
Star Strider
el 31 de Mayo de 2019
Try this:
set(gca, 'Clipping','on')
2 comentarios
Andreas Zaugg
el 31 de Mayo de 2019
Star Strider
el 31 de Mayo de 2019
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.
Categorías
Más información sobre Errorbars en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!