Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create figures and dock them into my main GUI figure?

1,206 views
Skip to first unread message

G.A.M.

unread,
Aug 27, 2007, 4:15:02 PM8/27/07
to
Is it possible (and relatively easy) to create figures that
dock into a parent figure? (I don't want to dock my figures
to the Matlab workspace.)

How do I dock my own figures into a main (parent) figure?
Thanks.

Ashwini Deshpande

unread,
Sep 7, 2007, 12:26:16 AM9/7/07
to
"G.A.M. " <x0z...@gmail.com> wrote in message <favbc6
$5uj$1...@fred.mathworks.com>...

Hi,

I think you can use subplot command to plot multiple graphs
in same window (figure)...

If you feel this command is noe suitable for your
application give some more idea about your requirement..

Regards,
Ashwini

G.A.M.

unread,
Sep 17, 2007, 9:01:03 PM9/17/07
to
"Ashwini Deshpande" <vd.as...@mathworks.com> wrote in
message <fbqjt8$ea8$1...@fred.mathworks.com>...

Docking is different from using subplots. I want to
programmatically create a figure (a window) and specify that
it should be docked within another figure I have created
earlier. Can Matlab do this? Thanks.

Adam

unread,
Sep 18, 2007, 8:13:15 AM9/18/07
to
"G.A.M. " <x0z...@gmail.com> wrote in message
<fcn80f$15l$1...@fred.mathworks.com>...

use:
set(<figurename>, 'WindowStyle', 'docked')

G.A.M.

unread,
Sep 18, 2007, 12:14:41 PM9/18/07
to
On Sep 18, 8:13 am, "Adam " <not.my.em...@mathworks.com> wrote:
> "G.A.M. " <x0z...@gmail.com> wrote in message
>
> <fcn80f$15...@fred.mathworks.com>...
>
>
>
> > "Ashwini Deshpande" <vd.ashw...@mathworks.com> wrote in
> > message <fbqjt8$ea...@fred.mathworks.com>...

> > > "G.A.M. " <x0z...@gmail.com> wrote in message <favbc6
> > > $5u...@fred.mathworks.com>...

> > > > Is it possible (and relatively easy) to create figures
> > > that
> > > > dock into a parent figure? (I don't want to dock my
> > > figures
> > > > to the Matlab workspace.)
>
> > > > How do I dock my own figures into a main (parent) figure?
> > > > Thanks.
>
> > > Hi,
>
> > > I think you can use subplot command to plot multiple graphs
> > > in same window (figure)...
>
> > > If you feel this command is noe suitable for your
> > > application give some more idea about your requirement..
>
> > > Regards,
> > > Ashwini
>
> > Docking is different from using subplots. I want to
> > programmatically create a figure (a window) and specify that
> > it should be docked within another figure I have created
> > earlier. Can Matlab do this? Thanks.
>
> use:
> set(<figurename>, 'WindowStyle', 'docked')

My understanding from reading help is that this command will only dock
a figure to the Matlab desktop. Is that correct? If I could pass it a
parent figure parameter, that might do what I need.

I want to create a main figure for my application and then dock my
other windows to MY figure. Thanks

Adam

unread,
Sep 18, 2007, 12:25:53 PM9/18/07
to
<SNIP>

> > use:
> > set(<figurename>, 'WindowStyle', 'docked')
>
> My understanding from reading help is that this command
will only dock
> a figure to the Matlab desktop. Is that correct? If I
could pass it a
> parent figure parameter, that might do what I need.
>
> I want to create a main figure for my application and then
dock my
> other windows to MY figure. Thanks

I don't have any experience using this. However...

fig1 = figure;
set(fig1, 'WindowStyle', 'docked')

fig2 = figure;
set(fig2, 'WindowStyle', 'docked')

creates one figure, then docks the second with the first.
For me it remembers the last docked configuration, not sure
how to change that.

Use get(fig1) and get(fig2) to analyze parameters if no one
else chimes in with details

G.A.M.

unread,
Sep 18, 2007, 12:54:36 PM9/18/07
to

I think I found what I need:
http://xtargets.com/cms/Tutorials/Matlab-Programming/Advanced-Layout-Management-With-Handle-Graphics.html

I just found it thanks to "per isakson". I haven't tried it yet, but
it looks like exactly what I was hoping to find.

Yair Altman

unread,
Sep 27, 2007, 9:08:05 PM9/27/07
to
> > Docking is different from using subplots. I want to
> > programmatically create a figure (a window) and specify that
> > it should be docked within another figure I have created
> > earlier. Can Matlab do this? Thanks.
>
> use:
> set(<figurename>, 'WindowStyle', 'docked')


Docking figures places them in the "Figures" group
container. Here is an undocumented/unsupported hack to dock
figures into your own custom-made group. This enables
docking some figures into the "Figures" container and others
into the "myGroup" container:

desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
myGroup = desktop.addGroup('myGroup');
set(get(gcf,'javaframe'), 'GroupName','myGroup');
% docking gcf will now add it to myGroup, not "Figures"

More hacks on groups (resizing, minimizing/maximizing,
docking/undocking etc.) can be found here:
http://tinyurl.com/32q6hb and: http://tinyurl.com/2xpxdp

Yair Altman
http://ymasoftware.com

Yair Altman

unread,
Oct 13, 2007, 6:06:05 PM10/13/07
to
"Yair Altman" <altma...@gmailDEL.comDEL> wrote in message
<fdhk5l$ch8$1...@fred.mathworks.com>...


For anyone interested, I recently posted a submission on the
File Exchange that handles figure docking into any Matlab or
user-defined figure-group (including odd groups like the
Matlab editor...): setFigDockGroup -
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16650

enjoy :)

Yair Altman

Scott Koch

unread,
Jan 25, 2008, 8:34:02 PM1/25/08
to
Hi Yair -

Thanks for posting all of the information, it's quite nice to be able to dock
figures in a separate window. I'm a total java hack but I thought I might post
some useful (I think) ways I came across to manipulate the dock even further:

%Pull contianter out of desktop.
desktop.setGroupDocked('myGroup',0);

%Set into 3x3 tiled mode.
myDim = java.qwt.Dimension;
myDim.height = 3;
myDim.width = 3;

I wonder if this might be what Antonia was asking for in the blog entry you
referenced above...

Thanks

Scott

Scott Koch

unread,
Jan 30, 2008, 1:31:01 PM1/30/08
to
oupDocked('myGroup',0);
>
> %Set into 3x3 tiled mode.
> myDim = java.qwt.Dimension;
> myDim.height = 3;
> myDim.width = 3;
>

Forgot the a command:

desktop.setDocumentArrangement('myGroup',2,myDim);

scott

Naor Movshovitz

unread,
Apr 29, 2008, 8:57:01 AM4/29/08
to
"Yair Altman" <altma...@gmailDEL.comDEL> wrote in message
<fdhk5l$ch8$1...@fred.mathworks.com>...
> Docking figures places them in the "Figures" group
> container...
>
Yair,
Here's a related question: I skipped a couple of releases
and am just encountering the "Figures" group container for
the first time (am now in R2008a). I would really like to
emulate the earlier behavior, i.e., figures create and STAY
in separate windows. My problem is that once you activate
the property editor, the figure becomes docked in the group
container, and STAYS docked even after closing the property
editor. Setting 'DockControls' to 'off' doesn't help, the
property editor will just set them to 'on'
and 'WindowStyle' to 'docked'. Can you think of a way
around this?
Thanks,
-naor
0 new messages