MATLAB Answers

Amyth
0

r2018a: newer MATLAB version can't automatically determine the correct xlim and ylim for plots

Asked by Amyth
on 25 Jun 2019
Latest activity Commented on by Amyth
on 25 Jun 2019
I have seen on other computers (running r2014,r2015a) that when you plot a graph (talking specifically about an errorbar plot), the function automatically determines the correct xlim and ylim and shows the line a little away from the axis.
But on another computer that I'm currently using (running r2018a), the generated plot results in bars kissing the y axis (i.e. xlim issue)
I have attached a generated plot and a fixed version of it (that I correct using xlim; the one I have seen other versions figure out automatically).
If there is a default setting that I'm missing, please educate me on that. If nothing, if you know, please tell me why these versions are so different. Newer versions are expected to be better, no?
Thanks!
----------------
% plotting the graph (examplot values)
meanss = [0.377 0.375 0.361];
semss = [0.008 0.008 0.008];
tt = errorbar(meanss, semss);
% changing xlim
xl = xlim;
xlim([xl(1)-0.5 xl(2)+0.5])
plots.png

  1 Comment

As far as I remember, even using MATLAB R2014a/R2015a sometimes gave me the worse arrangement of the axes limits, and I always used to set them manually.

Sign in to comment.

1 Answer

Answer by Jan
on 25 Jun 2019

The question is not clear, because there is no unique definition of what is "the correct xlim and ylim" value. It is a question of taste and depends on the needs. Therefore I would not dare to decide, which of the automatic limits are "better".
If you do not want the diagrams to touch the error bars, set the limits manually to the wanted values.

  1 Comment

you would not dare to decide which of the two plots I sent is "better"? I see. Why even bother commenting?

Sign in to comment.