[R] About plot graphs

Greg Snow Greg.Snow at imail.org
Fri Aug 27 04:51:21 CEST 2010


When you run any graphics command (layout in this case) and there is not a current graphics device (more technically only the null device) then a default graphics device is opened, that is what you are seeing.  What you need to do instead is open the device yourself before calling layout.  Which device that is depends greatly on information that the posting guide strongly suggests that you provide (another hint).

One possibility is:

> windows(width=12, height=6) 

Followed by layout and the plotting commands.  But whether that will work on your machine or not is still a bit of a mystery.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Stephen Liu
> Sent: Thursday, August 26, 2010 8:02 PM
> To: r-help at r-project.org
> Subject: Re: [R] About plot graphs
> 
> Hi Greg,
> 
> Thanks for your advice.
> 
> I'm not prepared altering the shape of the graphs to be plotted.  What
> I'm
> trying to do is to pop up a rectangle layout window with following
> command.
> 
> The command;
> layout(matrix(1:2, nrow=1))
> 
> pop up a square window.  What I need is a rectangular window for the
> graphs to
> be plotted.  Otherwise the graphs are squeezed changing shape.
> 
> I looked at ?layout but can't resolve how to make it.  Can you help?
> TIA
> 
> B.R.
> Stephen L
> 
> 
> 
> 
> ----- Original Message ----
> From: Greg Snow <Greg.Snow at imail.org>
> To: Stephen Liu <satimis at yahoo.com>; "r-help at r-project.org"
> <r-help at r-project.org>
> Sent: Fri, August 27, 2010 9:00:01 AM
> Subject: RE: [R] About plot graphs
> 
> There is a graphical parameter that controls whether a plot is square
> or takes
> up the maximum amount of room (rectangle), see ?par and look at the
> entry for
> pty.
> 
> 
> It is possible that you set pty='s' or it may be that the plot method
> sets it,
> without us knowing what type of object Date and Test01$Date are we
> don't know
> which method is creating your plot and cannot be much more help (that
> is meant
> as a subtle hint to provide the information requested in the footer of
> every
> post and the posting guide).
> 
> Some methods may set pty='s' as default but have an option to change
> it.
> 
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
> 
> 
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> > project.org] On Behalf Of Stephen Liu
> > Sent: Thursday, August 26, 2010 8:45 AM
> > To: r-help at r-project.org
> > Subject: [R] About plot graphs
> >
> > Hi folks,
> >
> > Following command prints 2 graphs side-by-side:-
> > layout(matrix(1:2, nrow=1))
> > plot(Date,Input_No.)
> > plot(Test01$Date, Test01$Input_No.)
> >
> > However each is a square graph I need a rectangular layout.  Pls
> advise
> > how to
> > make it.  TIA
> >
> > B.R.
> > satimis
> >
> >
> >
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> > guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list