Thread Subject: Plot window maximised

Subject: Plot window maximised

From: n o s p a m p l e a s e

Date: 28 Nov, 2007 09:26:38

Message: 1 of 16

When I execute plot(x,y), the plot window opens in normal model.

I want it to open in maximized mode. How can I do this? I am running
Matlab 2007a.

Subject: Plot window maximised

From: Huy

Date: 28 Nov, 2007 12:12:31

Message: 2 of 16

n o s p a m p l e a s e <nospam.please@alum.com> wrote in
message <87e0922f-8a41-4207-947b-
9f96c4a20059@e6g2000prf.googlegroups.com>...
> When I execute plot(x,y), the plot window opens in
normal model.
>
> I want it to open in maximized mode. How can I do this?
I am running
> Matlab 2007a.
>

you can do like that

  fig = figure
  set(fig,'units','normalized','outerposition',[0 0 1 1]);

  plot(x,y)

By the way, you could find more detail with key word:
maximized window figure in search section.

Subject: Plot window maximised

From: Huy

Date: 11 Dec, 2007 14:14:41

Message: 3 of 16

n o s p a m p l e a s e <nospam.please@alum.com> wrote in
message <87e0922f-8a41-4207-947b-
9f96c4a20059@e6g2000prf.googlegroups.com>...
> When I execute plot(x,y), the plot window opens in normal
model.
>
> I want it to open in maximized mode. How can I do this? I am
running
> Matlab 2007a.
>

Here is another pretty code:

jf =get(gcf,'JavaFrame');
jf.fClientProxy.getFrameProxy.getClientFrame.setMaximized(1)


Subject: Plot window maximised

From: Miroslav Balda

Date: 11 Dec, 2007 22:04:41

Message: 4 of 16

"Huy " <phananhhuy@mathworks.com> wrote in message
<fjm60h$5d3$1@fred.mathworks.com>...
> n o s p a m p l e a s e <nospam.please@alum.com> wrote in
> message <87e0922f-8a41-4207-947b-
> 9f96c4a20059@e6g2000prf.googlegroups.com>...
> > When I execute plot(x,y), the plot window opens in normal
> model.
> >
> > I want it to open in maximized mode. How can I do this?
I am
> running
> > Matlab 2007a.
> >
>
> Here is another pretty code:
>
> jf =get(gcf,'JavaFrame');
> jf.fClientProxy.getFrameProxy.getClientFrame.setMaximized(1)
>
>
Hi,

the simplest way how to place figure window on the full
screen is to call "fig(5);"

function fig.m for figure window placement in the coded
position can be found in FEX Id: 9035.

Mira



Subject: Plot window maximised

From: Miroslav Balda

Date: 11 Dec, 2007 22:04:41

Message: 5 of 16

"Huy " <phananhhuy@mathworks.com> wrote in message
<fjm60h$5d3$1@fred.mathworks.com>...
> n o s p a m p l e a s e <nospam.please@alum.com> wrote in
> message <87e0922f-8a41-4207-947b-
> 9f96c4a20059@e6g2000prf.googlegroups.com>...
> > When I execute plot(x,y), the plot window opens in normal
> model.
> >
> > I want it to open in maximized mode. How can I do this?
I am
> running
> > Matlab 2007a.
> >
>
> Here is another pretty code:
>
> jf =get(gcf,'JavaFrame');
> jf.fClientProxy.getFrameProxy.getClientFrame.setMaximized(1)
>
>
Hi,

the simplest way how to place figure window on the full
screen is to call "fig(5);"

function fig.m for figure window placement in the coded
position can be found in FEX Id: 9035.

Mira



Subject: Plot window maximised

From: Miroslav Balda

Date: 11 Dec, 2007 22:04:42

Message: 6 of 16

"Huy " <phananhhuy@mathworks.com> wrote in message
<fjm60h$5d3$1@fred.mathworks.com>...
> n o s p a m p l e a s e <nospam.please@alum.com> wrote in
> message <87e0922f-8a41-4207-947b-
> 9f96c4a20059@e6g2000prf.googlegroups.com>...
> > When I execute plot(x,y), the plot window opens in normal
> model.
> >
> > I want it to open in maximized mode. How can I do this?
I am
> running
> > Matlab 2007a.
> >
>
> Here is another pretty code:
>
> jf =get(gcf,'JavaFrame');
> jf.fClientProxy.getFrameProxy.getClientFrame.setMaximized(1)
>
>
Hi,

the simplest way how to place figure window on the full
screen is to call "fig(5);"

function fig.m for figure window placement in the coded
position can be found in FEX Id: 9035.

Mira



Subject: Plot window maximised

From: Paul Mennen

Date: 11 Dec, 2007 23:31:57

Message: 7 of 16

"Miroslav Balda" wrote
> > > I want it to open in maximized mode.

> Here is another pretty code:
> jf =get(gcf,'JavaFrame');
> jf.fClientProxy.getFrameProxy.
        getClientFrame.setMaximized(1)

I couldn't get that to work (in R2007b).
For the first line, I get

jf = com.mathworks.hg.peer.FigurePeer@1a8a9e7

And then the 2nd line gives me this error:

??? No appropriate method or public field com for class
com.mathworks.hg.peer.FigurePeer.

> the simplest way how to place figure window on the full
> screen is to call "fig(5);" (FEX Id: 9035.)
 
As Einstein said, things should be as simple as possible
but no simpler. This one is too simple. Perhaps this can
be done with some complex .m code, I don't know. For one
thing the .48 constant is not going to work for all screen
resolutions and configurations. To make matters worse, you
don't want the figure to overlap the task bar, and you
don't know where that is (top, bottom, left, right), nor
how big it is.

I wish I had a .m routine that could do this, but so far
I haven't found it. Now I do this with the
winshowwin(figHandle,'maximize') function which is part
of the Mpacks package from www.soundslogical.com.
(Its primary drawback is that it costs $40)

~Paul

Subject: Plot window maximised

From: Yair Altman

Date: 12 Dec, 2007 09:31:14

Message: 8 of 16

"Paul Mennen" <nospam@mennen.org> wrote in message
<fjn6ld$dhf$1@fred.mathworks.com>...
> "Miroslav Balda" wrote
> > > > I want it to open in maximized mode.
>
> > Here is another pretty code:
> > jf =get(gcf,'JavaFrame');
> > jf.fClientProxy.getFrameProxy.
> getClientFrame.setMaximized(1)
>
> I couldn't get that to work (in R2007b).
> For the first line, I get
>
> jf = com.mathworks.hg.peer.FigurePeer@1a8a9e7
>
> And then the 2nd line gives me this error:
>
> ??? No appropriate method or public field com for class
> com.mathworks.hg.peer.FigurePeer.


Here's a small fix for R2007b:

jf=get(gcf,'JavaFrame');
awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);

Yair Altman
http://ymasoftware.com

Subject: Plot window maximised

From: Huy

Date: 12 Dec, 2007 11:33:07

Message: 9 of 16

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message
<fjo9p2$n7g$1@fred.mathworks.com>...
> "Paul Mennen" <nospam@mennen.org> wrote in message
> <fjn6ld$dhf$1@fred.mathworks.com>...
> > "Miroslav Balda" wrote
> > > > > I want it to open in maximized mode.
> >
> > > Here is another pretty code:
> > > jf =get(gcf,'JavaFrame');
> > > jf.fClientProxy.getFrameProxy.
> > getClientFrame.setMaximized(1)
> >
> > I couldn't get that to work (in R2007b).
> > For the first line, I get
> >
> > jf = com.mathworks.hg.peer.FigurePeer@1a8a9e7
> >
> > And then the 2nd line gives me this error:
> >
> > ??? No appropriate method or public field com for class
> > com.mathworks.hg.peer.FigurePeer.
>
>
> Here's a small fix for R2007b:
>
> jf=get(gcf,'JavaFrame');
>
awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);
>
> Yair Altman
> http://ymasoftware.com
>


Thanks Yair Altman! You're right.



In MATLAB Version 7.1 (R14) (or older), we use

jf=get(gcf,'JavaFrame');
awtinvoke(jf.fClientProxy.getFrameProxy,'setMaximized(Z)',1);


and in MATLAB Version 7.2.(R2006a) (or later), we have

awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);

or

jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)


Anh Huy Phan

RIKEN - BSI

Subject: Plot window maximised

From: Stephan Hoffmann

Date: 14 Dec, 2007 13:49:01

Message: 10 of 16

Instead of:

> jf=get(gcf,'JavaFrame');
>
> awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized
(Z)',1);

you could also use:

set(jf,'Maximized',1);



Best regards,
Stephan Hoffmann

Subject: Plot window maximised

From: Stephan Hoffmann

Date: 14 Dec, 2007 13:49:57

Message: 11 of 16

Instead of:

> jf=get(gcf,'JavaFrame');
>
> awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized
(Z)',1);

you could also use:

set(jf,'Maximized',1);



Best regards,
Stephan Hoffmann

Subject: Plot window maximised

From: Marcelo Soto-Thompson

Date: 23 Oct, 2008 21:07:02

Message: 12 of 16

Running Stephan's code I get:
Exception in thread "AWT-EventQueue-0" java.lang.Error: FigureFrame object is NULL at com.mathworks.hg.peer.FigureFrameProxy.getClientFrame(FigureFrameProxy.java:195) at com.mathworks.hg.peer.FigureFrameProxy.setMaximized
... and a bunch of other similar error messages

Running Yair's code(s):
 jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)
Results in:
??? Attempt to reference field of non-structure array.

Code:
awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);
jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)

Results in:
Exception while dispatching java method:
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
... and a slew of similar messages

I'm running version 7.5.0.342 (R2007b) on Win Xp and I know zip about java programming. ;-)

Thanks

Subject: Plot window maximised

From: Marcelo Soto-Thompson

Date: 23 Oct, 2008 21:20:20

Message: 13 of 16

Weird..

I can get the code to work if I run it line by line in the command window NOT if run it from within a script or a function.

Subject: Plot window maximised

From: Yair Altman

Date: 23 Oct, 2008 21:36:02

Message: 14 of 16

"Marcelo Soto-Thompson" <marcelo@sti-hawaii.com> wrote in message <gdqp1m$t73$1@fred.mathworks.com>...
> <snip java error msgs>
> I'm running version 7.5.0.342 (R2007b) on Win Xp and I know zip about java programming. ;-)

The reason is that using jf (the Java Frame) requires the figure window to be visible, and in your code you probably try to maximize the window while its 'visible' property is 'off'.

Yair Altman

Subject: Plot window maximised

From: Marcelo Soto-Thompson

Date: 24 Oct, 2008 21:30:20

Message: 15 of 16

"Yair Altman"
> The reason is that using jf (the Java Frame) requires the figure window to be visible, and in your code you probably try to maximize the window while its 'visible' property is 'off'.
>
> Yair Altman

The figure's visible property is 'on'.

However, by adding a pause before retrieving the JavaFrame handle the code suddenly worked...

h = figure;
pause(0.01) %<== Adding this line made it all work...
jf=get(h,'JavaFrame');
set(jf,'Maximized',1);

I have no clue why it worked but sometimes, I guess, ignorance is bliss.

Thanks guys!

Subject: Plot window maximised

From: Mohamed Asheik

Date: 25 Oct, 2008 14:07:01

Message: 16 of 16

try this,

 figure('name',mfilename,...
                   'NumberTitle','off','Position',[20 20 700 500],...
                   'Color',[0.45 0.25 .05]);

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
plot maximized Mohamed Asheik 25 Oct, 2008 10:11:30
undocumented Yair Altman 12 Dec, 2007 04:31:48
java Yair Altman 12 Dec, 2007 04:31:47
rssFeed for this Thread

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.

Contact us at files@mathworks.com