Question

I have to plot graphics and compare them but it's misleading because of different y-axis upper bounds for each of them (they are all positive values). Anyway I'm doing a cycle like this:

 %% check for data files
 for i=1:length(files)
    load
    plot(x,y)
 end

I need to change my code if I want to save the maximum upper bound on y.

 %% check for data files
 for i=1:length(files)
    load
    %% compare upper bounds and get the maximum
 end
 %% plot cycle

But then how can I use this value to plot comparable but separated graphics. I can't plot them in only one figure because they are many. Also tell me If you think of a possible optimization for my task.

Was it helpful?

Solution

ylim is what you are looking for, but if i understood you right you might also want to look at linkaxes.

OTHER TIPS

You can use ylim. Check out these questions: 1, 2 or 3.

ylim([ymin ymax])   % or something like:  set(gca,'Ylim',yLimits)

sets the axis limits in the current axes to the specified values

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top