Hi! I am creating a GUI (using Matlab and GUIDE), and I
would like to draw a static, irregularly-shaped object on
my axes. From all of the Matlab documentation I've seen,
it is only possible to plot rectangles and ovals, but
nothing else.
Is my only option to overlay a large series of rectangles
& ovals to create my desired shape (if this is even
possible), or does someone know of a way to create a
static irregular shape easily?
Thanks for your help! Kathleen
Subject: Re: how to draw an irregular shape on GUI axes?
In article <f8td95$i7t$1@fred.mathworks.com>,
Kathleen <quisquiliae2@hotmail.com> wrote:
>Hi! I am creating a GUI (using Matlab and GUIDE), and I
>would like to draw a static, irregularly-shaped object on
>my axes. From all of the Matlab documentation I've seen,
>it is only possible to plot rectangles and ovals, but
>nothing else.
>Is my only option to overlay a large series of rectangles
>& ovals to create my desired shape (if this is even
>possible), or does someone know of a way to create a
>static irregular shape easily?
If it is static, you could possibly draw it into an image
and display the image.
If it is a filled polygon, you can use fill().
You can use plot() to create line plots; if you issued
a 'hold on' command, then the next plot would add to the
existing plot rather than erasing.
If it is a filled polygon, you can use patch()
--
Programming is what happens while you're busy making other plans.
Subject: Re: how to draw an irregular shape on GUI axes?
One more question: I have an animated object that needs to
be visible *over* the polygon (i.e., polygon needs to be
in the background). Right now, the polygon covers and
obscures the animation.
How can I layer these objects so that the polygon shape is
in the background?
Thanks! Kathleen
Subject: Re: how to draw an irregular shape on GUI axes?
In article <f8vfa2$9ar$1@fred.mathworks.com>,
Kathleen <quisquiliae2@hotmail.com> wrote:
>One more question: I have an animated object that needs to
>be visible *over* the polygon (i.e., polygon needs to be
>in the background). Right now, the polygon covers and
>obscures the animation.
>How can I layer these objects so that the polygon shape is
>in the background?
The newest object (that is, constructed more recently)
is the one that will be displayed on top.
See also the documentation on uistack()
Also, I can't think right at the second of exactly which page this
is documented on, but you can set the Children property of
handle graphics objects to change the order they stack in.
When you get() the Children property, the first child in the list
will be the one that appears on top, so to change the order,
set() the Children property to an appropriate permutation of
the original.
--
Prototypes are supertypes of their clones. -- maplesoft
Subject: Re: how to draw an irregular shape on GUI axes?
Thanks for your reply, Walter. I will investigate based on
your advice. (Note: a few minutes ago I posted this same
question as a new thread, thinking it would be better to
separate topics.)
Curiously, I draw the polygon as the very first object
within my OpeningFcn, yet when the animation appears, it's
still layered underneath. Weird! I will try working with
uistack() and get().
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.