Focusing auto axis to one curve over multiple

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 :)

 Accepted 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'

4 Comments

Renaud's comment posted as answer moved here:
Hi,
Thanks for the annswer. This way, I will still have the red curve plotted but it won't be taken into consideration by the software for the auto axis then ?
No, the above will make the red line completely invisible. The following code shows a workaround by first making the red line invisible, set the YLimMode to manual, and then making the red line visible again.
% first plot all the lines and get the line handles
ax % handle of axes object
p_red % plot handle of red line
p_red.Visible = 'off';
ax.YLimMode = 'manual';
p_red.Visible = 'on';
Ok, I'll try this on then ! thanks
I am glad to be of help!

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!