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

Subject: patch

From: Yuri Geshelin

Date: 5 Dec, 2008 14:00:20

Message: 1 of 3

Hi,

I have two PATCH objetcs, e.g.
ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');
ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');

the second is sitting on top of the first one, as it was created later. I want this to be the other way around, i.e. the first one on top. To achieve this, I am doing just blunt

delete(ip)
ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');
ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');

But is there a more natural way of flipping them? I checked the PATCH properties, but did not find anything to address this issue.

Thanks

Subject: patch

From: Steven Lord

Date: 5 Dec, 2008 14:15:48

Message: 2 of 3


"Yuri Geshelin" <geshelin@hotmail.com> wrote in message
news:ghbc5k$erp$1@fred.mathworks.com...
> Hi,
>
> I have two PATCH objetcs, e.g.
> ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');
> ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');
>
> the second is sitting on top of the first one, as it was created later. I
> want this to be the other way around, i.e. the first one on top. To
> achieve this, I am doing just blunt
>
> delete(ip)
> ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');
> ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');
>
> But is there a more natural way of flipping them? I checked the PATCH
> properties, but did not find anything to address this issue.

You can use UISTACK:

uistack(ip(1), 'up', 1)

or you can adjust the ZData property of one or both of the patches. If one
of the patches is at the default z level (corresponding to z = 0, I believe)
and the other is at level z = 0.1, the one at z = 0.1 will be on top of the
one at the default level.

--
Steve Lord
slord@mathworks.com

Subject: patch

From: Joerg Buchholz

Date: 5 Dec, 2008 14:16:59

Message: 3 of 3

"Yuri Geshelin" <geshelin@hotmail.com> wrote in message <ghbc5k$erp$1@fred.mathworks.com>...
> Hi,
>
> I have two PATCH objetcs, e.g.
> ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');
> ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');
>
> the second is sitting on top of the first one, as it was created later. I want this to be the other way around, i.e. the first one on top. To achieve this, I am doing just blunt
>
> delete(ip)
> ip(2) = patch([.25 .35 .35 .25],[.25 .25 .35 .35 ],'g');
> ip(1) = patch([.2 .3 .3 .2],[.2 .2 .3 .3 ],'r');
>
> But is there a more natural way of flipping them? I checked the PATCH properties, but did not find anything to address this issue.
>
> Thanks

You could do it via:

>> set (gca, 'children', flipud (get (gca, 'children')))

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