Auto axis limits not working as expected

I have a graph for which I want to limit the y axis to be positive. Research suggested to me the way to do this was ylim([0, inf]). However, rather than giving a 'nice' upper limit (like the default does), this command just sets the upper limit to the maximum value in my dataset. Is there a way to achieve what I am after? The best I have found is
yl = ylim()
ylim(0, yl(2))
but this doesn't allow the upper limit to continue updating if additional plots were included.

2 Kommentare

Stephen23
Stephen23 am 30 Mai 2019
Bearbeitet: Stephen23 am 30 Mai 2019
" Is there a way to achieve what I am after?"
Not easily, as far as I am aware. I think this behavior should be reported as a bug: it is quite reasonable to expect that the Inf limit should produce the same as the auto limits.
What MATLAB version are you using?
Andrew Haselgrove
Andrew Haselgrove am 30 Mai 2019
2019a

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2019a

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by