Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to identify axis on a figure

Subject: how to identify axis on a figure

From: Pinpress

Date: 4 Oct, 2011 13:49:27

Message: 1 of 3

Hi,

I created a figure with multiple axes on it using "subplot". I wonder how I can automatically identify the handle for an axes at a specific location. If I use:

hd = findall(gcf,'type', 'axes');

It will return multiple handles, but its order seem to correlate with the order of each subplot when it was created, not its specific location in the figure.

Any helpful tip would be appreciated.

Subject: how to identify axis on a figure

From: dpb

Date: 4 Oct, 2011 14:08:32

Message: 2 of 3

On 10/4/2011 8:49 AM, Pinpress wrote:
> Hi,
>
> I created a figure with multiple axes on it using "subplot". I wonder
> how I can automatically identify the handle for an axes at a specific
> location....

subplot() axes are numbered from left starting at top row then second
row, etc., etc., ...

One could, w/ some effort, determine the size and knowing the number
work out where each are.

Would seem simpler to simply request/set the desired axes set to work on...

--

Subject: how to identify axis on a figure

From: Steven_Lord

Date: 4 Oct, 2011 14:59:01

Message: 3 of 3



"Pinpress" <nospam__@yahoo.com> wrote in message
news:j6f2t7$qmj$1@newscl01ah.mathworks.com...
> Hi,
>
> I created a figure with multiple axes on it using "subplot". I wonder how
> I can automatically identify the handle for an axes at a specific
> location. If I use:
>
> hd = findall(gcf,'type', 'axes');
>
> It will return multiple handles, but its order seem to correlate with the
> order of each subplot when it was created, not its specific location in
> the figure.
> Any helpful tip would be appreciated.

Two options are to:

Store the handles of the subplots when you created them and refer to the
appropriate stored handle when you need it later in your code.

Give each subplot a specific value for the 'Tag' property at creation and
either use FINDALL to locate the axes with the desired tag or, if this is
part of a GUI, extract the handle from the appropriate field of the handles
structure.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

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.

Contact us