How can I start my axis from 0 but keep the max limit automatic?

177 views (last 30 days)
y-axis of my plot starts from negavite values but I want it to start from zero. I can not know the max value until I execute the code. Since I will be using the code for many data, I have tried to use ylim, v= axis...Thank you in advance for your help

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 15 Aug 2014
ylim([0 inf])

More Answers (1)

Adam
Adam on 15 Aug 2014
Edited: Adam on 15 Aug 2014
Probably not the neatest solution ( Azzi Abdelmalek's solution is better! ), but you could just use the auto limits each time you update/refrseh your plot, then immediately afterwards set the lower x limit to 0.
e.g.
ylims = get( hAxes, 'Ylim' )
ylims(1) = 0;
set( hAxes, 'Ylim', ylims )

Tags

Products

Community Treasure Hunt

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

Start Hunting!