Can you set the y-axis scale, but allow for a variable range?
Show older comments
For instance, is it possible to restrict the y axis to a certain length, but allow that length to fall anywhere based on the given data?
I have several subplots that plot in different areas along the y-axis, but I need the plot scale to be maintained.
Answers (1)
Just use something like this
x=1:10;
y=rand(1,numel(x))+5
the_length=1; %length on x axis to view
plot(x,y)
set(gca, 'ylim', [min(y), min(y)+the_length])
2 Comments
Walter Roberson
on 24 Aug 2018
set(gca, 'ylim', [ymin, ymin+the_length])
jonas
on 24 Aug 2018
ops.. thanks WR
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!