Thread Subject:
Is matlabs automatic axis limit function available?

Subject: Is matlabs automatic axis limit function available?

From: Daniel Armyr

Date: 8 Dec, 2008 10:42:01

Message: 1 of 4

Hi.
I am writing a custom plotting function, and one of the most difficult things to implement is the function that takes the range of the input data and sugests the axis limits and the tick spacing. Does anyone know if it is possible in some way to access matlabs such built-in function?

Sincerely
Daniel Armhyr

Subject: Is matlabs automatic axis limit function available?

From: Jos

Date: 8 Dec, 2008 10:51:01

Message: 2 of 4

"Daniel Armyr" <firstname@lastname.se> wrote in message <ghitlp$b4h$1@fred.mathworks.com>...
> Hi.
> I am writing a custom plotting function, and one of the most difficult things to implement is the function that takes the range of the input data and sugests the axis limits and the tick spacing. Does anyone know if it is possible in some way to access matlabs such built-in function?
>
> Sincerely
> Daniel Armhyr

Something like this?

x = 100*rand(3,1) ;
y = 100*rand(3,1) ;
tempaxes = axes('position',[0 0 1 1],'visible','off') ;
plot(x,y) ;
suggestedXlimits = get(tempaxes,'xlim')
% and other properties
delete(tempaxes)
 
hth, Jos

Subject: Is matlabs automatic axis limit function available?

From: Daniel Armyr

Date: 8 Dec, 2008 12:20:17

Message: 3 of 4

> Something like this?
Well, yeah, pretty much. The "Visibility off" trick was nifty. But this is really a very, very ugly hack. I had hoped for something a bit prettier. But for now, it will probably do ver well.

Thank you very much.

--DA

Subject: Is matlabs automatic axis limit function available?

From: Jos

Date: 8 Dec, 2008 13:34:02

Message: 4 of 4

"Daniel Armyr" <firstname@lastname.se> wrote in message <ghj3e1$a05$1@fred.mathworks.com>...
> > Something like this?
> Well, yeah, pretty much. The "Visibility off" trick was nifty. But this is really a very, very ugly hack. I had hoped for something a bit prettier. But for now, it will probably do ver well.
>
> Thank you very much.
>
> --DA

I agree it's ugly, but wrap it inside a function with a nice name and you'll never know ;-)

Jos

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
plot Daniel Armyr 8 Dec, 2008 05:45:08
axis Daniel Armyr 8 Dec, 2008 05:45:08
limits Daniel Armyr 8 Dec, 2008 05:45:08
rssFeed for this Thread

Contact us