Thread Subject: ylim

Subject: ylim

From: Shaddy

Date: 20 Nov, 2009 22:35:06

Message: 1 of 7

can I use the ylim command to fix one side of the axis manually and leave the other one as auto ?

Thanks

Subject: ylim

From: Wayne King

Date: 21 Nov, 2009 00:03:06

Message: 2 of 7

"Shaddy " <shaddyab@gmail.com> wrote in message <he75iq$hgf$1@fred.mathworks.com>...
> can I use the ylim command to fix one side of the axis manually and leave the other one as auto ?
>
> Thanks
Hi, yes, you can use:

plot(randn(100,1),'k*');
set(gca,'ylim',[-2 2]);

wayne

Subject: ylim

From: Shaddy

Date: 23 Nov, 2009 14:58:06

Message: 3 of 7

"Wayne King" <wmkingty@gmail.com> wrote in message <he7anq$3d4$1@fred.mathworks.com>...
> "Shaddy " <shaddyab@gmail.com> wrote in message <he75iq$hgf$1@fred.mathworks.com>...
> > can I use the ylim command to fix one side of the axis manually and leave the other one as auto ?
> >
> > Thanks
> Hi, yes, you can use:
>
> plot(randn(100,1),'k*');
> set(gca,'ylim',[-2 2]);
>
> wayne

Hey,

I do not think that I received an answer for my question, I know that I can set ylim and leave xlim auto.
My question was if I can do something like
ylim([-2 Auto])

Thanks

Subject: ylim

From: dpb

Date: 23 Nov, 2009 15:18:07

Message: 4 of 7

Shaddy wrote:
...
> I do not think that I received an answer for my question, I know that
> I can set ylim and leave xlim auto.
> My question was if I can do something like
> ylim([-2 Auto])

No, the 'Auto' value is only a property of X|Y|ZLimMode not of X|Y|ZLim

--

Subject: ylim

From: Matt

Date: 23 Nov, 2009 15:21:18

Message: 5 of 7

"Shaddy " <shaddyab@gmail.com> wrote in message <hee7tu$qt2$1@fred.mathworks.com>...
 
> I do not think that I received an answer for my question, I know that I can set ylim and leave xlim auto.
> My question was if I can do something like
> ylim([-2 Auto])


You can do ylim([-2 inf]). This will have the affect of making sure the y-axis starts at
-2, but doesn't constrain anything for y>=-2

Subject: ylim

From: Matt Fig

Date: 23 Nov, 2009 15:28:18

Message: 6 of 7

dpb <none@non.net> wrote in message <hee93u$mmh$1@news.eternal-
> No, the 'Auto' value is only a property of X|Y|ZLimMode not of X|Y|ZLim


But you can do something like this, if it is what you are really after:

[x,y] = humps(0:.01:2);
plot(x,y)
YL = get(gca,'ylim');
set(gca,'ylim',[-5 YL(2)]) % Adjust only the lower limit.

Subject: ylim

From: Eric Diaz

Date: 28 Feb, 2010 04:06:02

Message: 7 of 7

That is exactly what I wanted too.

In my situation, I was plotting the mean of my data set with errorbars set to the length of the data's standard of deviation. However, my data set must be positive, and so, when the error bars would go into the negative domain my graph's 'ylim' property would expand to show it. On the one hand, the graph is doing what it should, but on the other hand, my data is only positive as it is calculated as a magnitude. Thus, I cannot have negative values, even if the errorbars say I can.

So, I think TMW should perhaps implement the ability to adjust a bit more easily the 'ylim' property, on a per limit basis, as the question requests.

Eric

"Matt Fig" <spamanon@yahoo.com> wrote in message <hee9mi$lej$1@fred.mathworks.com>...
> dpb <none@non.net> wrote in message <hee93u$mmh$1@news.eternal-
> > No, the 'Auto' value is only a property of X|Y|ZLimMode not of X|Y|ZLim
>
>
> But you can do something like this, if it is what you are really after:
>
> [x,y] = humps(0:.01:2);
> plot(x,y)
> YL = get(gca,'ylim');
> set(gca,'ylim',[-5 YL(2)]) % Adjust only the lower limit.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
xlim ylim zlim Shaddy 20 Nov, 2009 17:39:24
rssFeed for this Thread

Contact us at files@mathworks.com