MATLAB Answers

Abhinaya
0

Changing y axis range

Asked by Abhinaya
on 23 Jun 2016
Latest activity Edited by Muhammad Usman Saleem on 23 Jun 2016
The y-limit in my plot is automatically scaled and it does not take the ylim I specify. How do I fix this

  1 Comment

dpb
on 23 Jun 2016
Say "please?", maybe?

Sign in to comment.

2 Answers

dpb
Answer by dpb
on 23 Jun 2016

How are we to know? The point of the above comment is that without knowing what you're doing there's nothing we can say specifically; we can't see your terminal session from here.
But, the documentation on ylim in the Tips section says--
"When the axis limit mode is set to auto (the default), MATLAB uses limits, which are round numbers, to span the range of the data being displayed. Setting a value for any of the limits also sets the corresponding mode to manual. If you set the limits on an existing graph and want to maintain these limits while adding more graphs, use the hold command."
It goes on to point out, however:
"Note:  High-level plotting functions like plot and surf reset both the modes and the limits."
The crystal ball says the latter is likely your culprit...

  0 Comments

Sign in to comment.


Answer by Muhammad Usman Saleem on 23 Jun 2016
Edited by Muhammad Usman Saleem on 23 Jun 2016

try this
ylim([20.5 37.5]);
set(gca, 'clim', [min(Ci(:)) max(Ci(:))]);
Ci will be matrix

  0 Comments

Sign in to comment.