MATLAB: Focusing auto axis to one curve over multiple

axisylim;

Hi everyone,
I know I can set limits to a plot, using *.Ylim for example, or I can also leave it without any precision so it will be automatically set up. My problem is I have some datas that are wrong and I would like to know If it's possible to focus this auto axis on one or two of my curves instead of all my curves. In my example :
I would then focus the axis dimension on the blue curve only.
Thanks in advance
Renaud 🙂

Best Answer

You need to turn off the visibility of the curve you want to exclude. For example
p1 = plot(1:10);
hold on
p2 = plot(21:30);
after figure is created, run following line.
p2.Visible = 'off'