Thread Subject: Can a uicontrol contain a plot?

Subject: Can a uicontrol contain a plot?

From: G.A.M.

Date: 20 Aug, 2007 00:08:09

Message: 1 of 8

I would like to make a series of small plots where any
subplot, when clicked with the mouse, will open into a full
sized plot with extra details.

I have to do it all programmatically (in m files).

Can I display a plot in a uicontrol (a push button)?

If so, maybe I can add N uicontrols on a panel and display a
plot on each uicontrol and assign a function to
ButtonDownFcn that will grab some values from the plot's
UserData and generate a new full sized plot (with more details).

If this will work, can anyone give me some tips or examples
on how to implement it? It would be cool if there is a way
to add the uicontrols similar to the subplot method (i.e.,
by using m, n, p).
Thanks.

Subject: Can a uicontrol contain a plot?

From: G.A.M.

Date: 20 Aug, 2007 00:18:01

Message: 2 of 8

I'm definitely going to need some help with this. So far I
have learned:

"An object of class axes, can not be a child of class
uicontrol."

Any suggestions are appreciated.

"G.A.M. " <x0zero@gmail.com> wrote in message
<faam18$str$1@fred.mathworks.com>...
> I would like to make a series of small plots where any
> subplot, when clicked with the mouse, will open into a full
> sized plot with extra details.
>
> I have to do it all programmatically (in m files).
>
> Can I display a plot in a uicontrol (a push button)?
>
> If so, maybe I can add N uicontrols on a panel and display a
> plot on each uicontrol and assign a function to
> ButtonDownFcn that will grab some values from the plot's
> UserData and generate a new full sized plot (with more
details).
>
> If this will work, can anyone give me some tips or examples
> on how to implement it? It would be cool if there is a way
> to add the uicontrols similar to the subplot method (i.e.,
> by using m, n, p).
> Thanks.

Subject: Can a uicontrol contain a plot?

From: Dan Haeg

Date: 20 Aug, 2007 01:57:16

Message: 3 of 8

"G.A.M. " <x0zero@gmail.com> wrote in message
<faam18$str$1@fred.mathworks.com>...
> I would like to make a series of small plots where any
> subplot, when clicked with the mouse, will open into a full
> sized plot with extra details.
>
> I have to do it all programmatically (in m files).
>
> Can I display a plot in a uicontrol (a push button)?
>
> If so, maybe I can add N uicontrols on a panel and display a
> plot on each uicontrol and assign a function to
> ButtonDownFcn that will grab some values from the plot's
> UserData and generate a new full sized plot (with more
details).
>
> If this will work, can anyone give me some tips or examples
> on how to implement it? It would be cool if there is a way
> to add the uicontrols similar to the subplot method (i.e.,
> by using m, n, p).
> Thanks.

A subplot can have a ButtonDownFcn

Subject: Can a uicontrol contain a plot?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 20 Aug, 2007 03:03:20

Message: 4 of 8

In article <faam18$str$1@fred.mathworks.com>, G.A.M. <x0zero@gmail.com> wrote:

>Can I display a plot in a uicontrol (a push button)?

>If so, maybe I can add N uicontrols on a panel and display a
>plot on each uicontrol and assign a function to
>ButtonDownFcn that will grab some values from the plot's
>UserData and generate a new full sized plot (with more details).

uicontrols cannot, as you have indicated you learned, have axes
as children.

However, there is a sense in which a uicontrol could
display a plot: pushbuttons and togglebuttons can have a CData
property,

    Truecolor image displayed on control. A three-dimensional matrix of
    RGB values that defines a truecolor image displayed on a control,
    which must be a push button or toggle button. Each value must be
    between 0.0 and 1.0.

So if you were to render the plot offscreen, then use the rendered
image as your CData, then the button would appear to have a
(static!) plot.

I am not recommending this method; it just would not be quite
right to say that uicontrols -cannot- have "plots".
--
   I was very young in those days, but I was also rather dim.
   -- Christopher Priest

Subject: Can a uicontrol contain a plot?

From: G.A.M.

Date: 20 Aug, 2007 03:26:08

Message: 5 of 8

Thanks for both the suggestions.

I think I'll try adding a ButtonDownFcn to a subplot. If
that doesn't fit my needs, I'll try the creative CData
suggestion. Thanks!

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fab09o$f8e$1@canopus.cc.umanitoba.ca>...
> In article <faam18$str$1@fred.mathworks.com>, G.A.M.
<x0zero@gmail.com> wrote:
>
> >Can I display a plot in a uicontrol (a push button)?
>
> >If so, maybe I can add N uicontrols on a panel and display a
> >plot on each uicontrol and assign a function to
> >ButtonDownFcn that will grab some values from the plot's
> >UserData and generate a new full sized plot (with more
details).
>
> uicontrols cannot, as you have indicated you learned, have
axes
> as children.
>
> However, there is a sense in which a uicontrol could
> display a plot: pushbuttons and togglebuttons can have a CData
> property,
>
> Truecolor image displayed on control. A
three-dimensional matrix of
> RGB values that defines a truecolor image displayed on
a control,
> which must be a push button or toggle button. Each
value must be
> between 0.0 and 1.0.
>
> So if you were to render the plot offscreen, then use the
rendered
> image as your CData, then the button would appear to have a
> (static!) plot.
>
> I am not recommending this method; it just would not be quite
> right to say that uicontrols -cannot- have "plots".
> --
> I was very young in those days, but I was also rather dim.
> -- Christopher Priest

Subject: Can a uicontrol contain a plot?

From: G.A.M.

Date: 20 Aug, 2007 14:16:15

Message: 6 of 8

"Dan Haeg" <haegd@msoe.edu> wrote in message
> > I would like to make a series of small plots where any
> > subplot, when clicked with the mouse, will open into a
> > full sized plot with extra details.
> >

>
> A subplot can have a ButtonDownFcn

What is the best way to obtain the value of the current
subplot's UserData property (or any other property) from
within the function assigned to ButtonDownFcn? The current
subplot should be the one being clicked, right? Or is it a
bit more nebulous than that?

Subject: Can a uicontrol contain a plot?

From: Dan Haeg

Date: 20 Aug, 2007 14:37:53

Message: 7 of 8

"G.A.M. " <x0zero@gmail.com> wrote in message
<fac7nf$r4u$1@fred.mathworks.com>...
> "Dan Haeg" <haegd@msoe.edu> wrote in message
> > > I would like to make a series of small plots where any
> > > subplot, when clicked with the mouse, will open into a
> > > full sized plot with extra details.
> > >
>
> >
> > A subplot can have a ButtonDownFcn
>
> What is the best way to obtain the value of the current
> subplot's UserData property (or any other property) from
> within the function assigned to ButtonDownFcn? The current
> subplot should be the one being clicked, right? Or is it a
> bit more nebulous than that?

gca is the current subplot as you would expect.

get(gca,'userdata')

Subject: Can a uicontrol contain a plot?

From: G.A.M.

Date: 20 Aug, 2007 17:02:10

Message: 8 of 8

This thread is related to another one I started. Here is the
link:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/154780

I cannot get the code:

get(gca,'userdata')

to work correctly yet.

Also, what is the best way to reference another thread in
this newsgroup? Is a link such as the one above OK?

Also, is there a faq that discusses things like whether I
should trim the previous messages or not when replying?

Thanks.

"Dan Haeg" <haegd@msoe.edu> wrote in message
>
> gca is the current subplot as you would expect.
>
> get(gca,'userdata')

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
buttondownfcn s... G.A.M. 20 Aug, 2007 10:20:21
uicontrols G.A.M. 19 Aug, 2007 20:10:19
figures G.A.M. 19 Aug, 2007 20:10:19
buttons G.A.M. 19 Aug, 2007 20:10:19
subplots G.A.M. 19 Aug, 2007 20:10:19
rssFeed for this Thread

Contact us at files@mathworks.com