Hui Du
2013-Sep-26 16:47 UTC
[R] plot multiple graphs in one graph and in multiple windows
Hi All,
I have a question about plotting graphs. Supposedly, I want to plot 12 graphs.
Putting 12 graphs to one window seems too crowded. Ideally, I want to put 4
pictures in one window and plot them in three separate window. For exmaple, my
psuedo code is like
par(mfrow = c(2, 2))
for( I in 1:12)
{
plot(rnorm(100));
if( i %% 4 == 0)
#
# open a New window with par(mfrow = c(2, 2)):
# My question is how to control here? Thank you for your help.
#
}
HXD
[[alternative HTML version deleted]]
Greg Snow
2013-Sep-26 22:31 UTC
[R] plot multiple graphs in one graph and in multiple windows
I think that you want:
if (i %% 4 == 1 ) {
dev.new()
par(mfrow=c(2,2))
}
or with the R 3.0.2 it looks like you will be able to do:
if( par('page') ) {
dev.new()
par(mfrow=c(2,2))
}
On Thu, Sep 26, 2013 at 10:47 AM, Hui Du <Hui.Du@dataventures.com> wrote:
>
> Hi All,
>
> I have a question about plotting graphs. Supposedly, I want to plot 12
> graphs. Putting 12 graphs to one window seems too crowded. Ideally, I want
> to put 4 pictures in one window and plot them in three separate window. For
> exmaple, my psuedo code is like
>
>
> par(mfrow = c(2, 2))
>
> for( I in 1:12)
> {
> plot(rnorm(100));
>
> if( i %% 4 == 0)
> #
> # open a New window with par(mfrow = c(2, 2)):
> # My question is how to control here? Thank you for your help.
> #
> }
>
> HXD
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
--
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com
[[alternative HTML version deleted]]
Patrick Connolly
2013-Oct-03 07:52 UTC
[R] plot multiple graphs in one graph and in multiple windows
On Thu, 26-Sep-2013 at 04:47PM +0000, Hui Du wrote:
|>
|> Hi All,
|>
|> I have a question about plotting graphs. Supposedly, I want to plot
|> 12 graphs. Putting 12 graphs to one window seems too
|> crowded. Ideally, I want to put 4 pictures in one window and plot
|> them in three separate window. For exmaple, my psuedo code is like
Depends how you use them. I'd be inclined to make them into a 3 page
PDF file. However, if you really need to see them simultaneously on
the screen and can see 3 plotting windows on your screen, it would be
easier still to make the plotting window larger and do all 12 in that
window using par(mfrow = c(4, 3)) pr par(mfrow = c(3, 4)).
HTH
|>
|> par(mfrow = c(2, 2))
|>
|> for( I in 1:12)
|> {
|> plot(rnorm(100));
|>
|> if( i %% 4 == 0)
|> #
|> # open a New window with par(mfrow = c(2, 2)):
|> # My question is how to control here? Thank you for your help.
|> #
|> }
|>
|> HXD
|>
|> [[alternative HTML version deleted]]
|>
|> ______________________________________________
|> 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.
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
___ Patrick Connolly
{~._.~} Great minds discuss ideas
_( Y )_ Average minds discuss events
(:_~*~_:) Small minds discuss people
(_)-(_) ..... Eleanor Roosevelt
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.