MATLAB: Are the axis limits different in R2017b than in R2018a and later

automatic;axisdifferentinconsistentlimitsMATLABplotxlimylim;

I want to create a 2D line plot of my data. However, when I create this plot in R2017b and R2018a (or later), the Y-axis limits of the two resulting axes have different bounds. Namely, the Y-axis bounds are tighter in R2018a (and later) than they are in R2017b. Why is this, and how do I correct this issue?

Best Answer

This change in behavior is expected and documented in the following release notes page:
Furthermore, this difference only occurs when letting MATLAB determine the axis limits automatically.
At this time, the only way to achieve consistent axis limits for the same plot of data between R2017bĀ and a later release of MATLAB is to manually specify the axis limits. This can be done using, for instance, the "xlim" and "ylim" commands.