stack charts right on top of each other

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

stack charts right on top of each other

tom soyer
Hi,

I tried to stack two charts on top of each other using the following
R functions:

par(mfrow=c(2,1))
plot(rnorm(1:3),xaxt="n",xlab="")
plot(rnorm(1:3))

This created two charts, one on top of the other, but there is too much
space between them. Does anyone know how to elimiate the space in between
the charts?

Thanks,

--
Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

jholtman
try this to get them to butt up against each other:

layout(rbind(1,2))
par(mar=c(0,4,3,2))
plot(rnorm(1:3),xaxt="n",xlab="")
par(mar=c(4,4,0,2))
plot(rnorm(1:3))

On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:

> Hi,
>
> I tried to stack two charts on top of each other using the following
> R functions:
>
> par(mfrow=c(2,1))
> plot(rnorm(1:3),xaxt="n",xlab="")
> plot(rnorm(1:3))
>
> This created two charts, one on top of the other, but there is too much
> space between them. Does anyone know how to elimiate the space in between
> the charts?
>
> Thanks,
>
> --
> Tom
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

Uwe Ligges
In reply to this post by tom soyer
See ?par and its argument "mar"

Uwe Ligges



tom soyer wrote:

> Hi,
>
> I tried to stack two charts on top of each other using the following
> R functions:
>
> par(mfrow=c(2,1))
> plot(rnorm(1:3),xaxt="n",xlab="")
> plot(rnorm(1:3))
>
> This created two charts, one on top of the other, but there is too much
> space between them. Does anyone know how to elimiate the space in between
> the charts?
>
> Thanks,
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

tom soyer
In reply to this post by jholtman
Thanks Jim! It seems layout() is necessary in addition to mar=. I have a
follow up question: is there a way to specify the height of each chart so
that all the charts have the same height? I tried pin=, but it created more
space (if the height is set to a small value) between the charts, although
it fixed the height of each chart. Thanks!


On 12/31/07, jim holtman <[hidden email]> wrote:

>
> try this to get them to butt up against each other:
>
> layout(rbind(1,2))
> par(mar=c(0,4,3,2))
> plot(rnorm(1:3),xaxt="n",xlab="")
> par(mar=c(4,4,0,2))
> plot(rnorm(1:3))
>
> On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:
> > Hi,
> >
> > I tried to stack two charts on top of each other using the following
> > R functions:
> >
> > par(mfrow=c(2,1))
> > plot(rnorm(1:3),xaxt="n",xlab="")
> > plot(rnorm(1:3))
> >
> > This created two charts, one on top of the other, but there is too much
> > space between them. Does anyone know how to elimiate the space in
> between
> > the charts?
> >
> > Thanks,
> >
> > --
> > Tom
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>



--
Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

Gabor Grothendieck
In reply to this post by tom soyer
Check out:
http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm

On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:

> Hi,
>
> I tried to stack two charts on top of each other using the following
> R functions:
>
> par(mfrow=c(2,1))
> plot(rnorm(1:3),xaxt="n",xlab="")
> plot(rnorm(1:3))
>
> This created two charts, one on top of the other, but there is too much
> space between them. Does anyone know how to elimiate the space in between
> the charts?
>
> Thanks,
>
> --
> Tom
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

tom soyer
Thanks Gabor. mar= and oma= by themselves won't be able to do it. layout()
is necessary per Jim's post. But now I am stuck with another problem when I
tried to define the height of each chart:

layout(rbind(1,2))
par(mar=c(0,4,4,2),pin=c(4,2))
plot(rnorm(1:3),xaxt="n",xlab="")
par(mar=c(5,4,0,2),pin=c(4,0.5))
plot(rnorm(1:3))

somehow if pin is used, it creates more space between the charts. I don't
know where the space comes from. I mean, mar= is already set to zero for the
relevent sides.


On 12/31/07, Gabor Grothendieck <[hidden email]> wrote:

>
> Check out:
>
> http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm
>
> On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:
> > Hi,
> >
> > I tried to stack two charts on top of each other using the following
> > R functions:
> >
> > par(mfrow=c(2,1))
> > plot(rnorm(1:3),xaxt="n",xlab="")
> > plot(rnorm(1:3))
> >
> > This created two charts, one on top of the other, but there is too much
> > space between them. Does anyone know how to elimiate the space in
> between
> > the charts?
> >
> > Thanks,
> >
> > --
> > Tom
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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.
> >
>



--
Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

jholtman
In reply to this post by tom soyer
To make the charts the same size, try setting the top and bottom
margins to be the same; e.g.,

layout(rbind(1,2))
par(mar=c(0,4,4,2))
plot(rnorm(1:3),xaxt="n",xlab="")
par(mar=c(4,4,0,2))
plot(rnorm(1:3))

On Dec 31, 2007 1:16 PM, tom soyer <[hidden email]> wrote:

> Thanks Jim! It seems layout() is necessary in addition to mar=. I have a
> follow up question: is there a way to specify the height of each chart so
> that all the charts have the same height? I tried pin=, but it created more
> space (if the height is set to a small value) between the charts, although
> it fixed the height of each chart. Thanks!
>
>
> On 12/31/07, jim holtman <[hidden email]> wrote:
> > try this to get them to butt up against each other:
> >
> > layout(rbind(1,2))
> > par(mar=c(0,4,3,2))
> > plot(rnorm(1:3),xaxt="n",xlab="")
> > par(mar=c(4,4,0,2))
> > plot(rnorm(1:3))
> >
> > On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:
> > > Hi,
> > >
> > > I tried to stack two charts on top of each other using the following
> > > R functions:
> > >
> > > par(mfrow=c(2,1))
> > > plot(rnorm(1:3),xaxt="n",xlab="")
> > > plot(rnorm(1:3))
> > >
> > > This created two charts, one on top of the other, but there is too much
> > > space between them. Does anyone know how to elimiate the space in
> between
> > > the charts?
> > >
> > > Thanks,
> > >
> > > --
> > > Tom
> > >
> > >        [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] 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.
> > >
> >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem you are trying to solve?
> >
>
>
>
> --
> Tom



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

tom soyer
In reply to this post by tom soyer
Sorry Gabor, you are right, using mar= alone is enough to do the stacking. I
was wrong.

On 12/31/07, tom soyer <[hidden email]> wrote:

>
> Thanks Gabor. mar= and oma= by themselves won't be able to do it. layout()
> is necessary per Jim's post. But now I am stuck with another problem when I
> tried to define the height of each chart:
>
> layout(rbind(1,2))
> par(mar=c(0,4,4,2),pin=c(4,2))
> plot(rnorm(1:3),xaxt="n",xlab="")
> par(mar=c(5,4,0,2),pin=c(4,0.5))
> plot(rnorm(1:3))
>
> somehow if pin is used, it creates more space between the charts. I don't
> know where the space comes from. I mean, mar= is already set to zero for the
> relevent sides.
>
>
>  On 12/31/07, Gabor Grothendieck <[hidden email]> wrote:
> >
> > Check out:
> > http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm
> >
> >
> > On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:
> > > Hi,
> > >
> > > I tried to stack two charts on top of each other using the following
> > > R functions:
> > >
> > > par(mfrow=c(2,1))
> > > plot(rnorm(1:3),xaxt="n",xlab="")
> > > plot(rnorm(1:3))
> > >
> > > This created two charts, one on top of the other, but there is too
> > much
> > > space between them. Does anyone know how to elimiate the space in
> > between
> > > the charts?
> > >
> > > Thanks,
> > >
> > > --
> > > Tom
> > >
> > >        [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
>
>
>
> --
> Tom




--
Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: stack charts right on top of each other

tom soyer
In reply to this post by jholtman
Thanks Jim!

On 12/31/07, jim holtman <[hidden email]> wrote:

>
> To make the charts the same size, try setting the top and bottom
> margins to be the same; e.g.,
>
> layout(rbind(1,2))
> par(mar=c(0,4,4,2))
> plot(rnorm(1:3),xaxt="n",xlab="")
> par(mar=c(4,4,0,2))
> plot(rnorm(1:3))
>
> On Dec 31, 2007 1:16 PM, tom soyer <[hidden email]> wrote:
> > Thanks Jim! It seems layout() is necessary in addition to mar=. I have a
> > follow up question: is there a way to specify the height of each chart
> so
> > that all the charts have the same height? I tried pin=, but it created
> more
> > space (if the height is set to a small value) between the charts,
> although
> > it fixed the height of each chart. Thanks!
> >
> >
> > On 12/31/07, jim holtman <[hidden email]> wrote:
> > > try this to get them to butt up against each other:
> > >
> > > layout(rbind(1,2))
> > > par(mar=c(0,4,3,2))
> > > plot(rnorm(1:3),xaxt="n",xlab="")
> > > par(mar=c(4,4,0,2))
> > > plot(rnorm(1:3))
> > >
> > > On Dec 31, 2007 11:53 AM, tom soyer <[hidden email]> wrote:
> > > > Hi,
> > > >
> > > > I tried to stack two charts on top of each other using the following
> > > > R functions:
> > > >
> > > > par(mfrow=c(2,1))
> > > > plot(rnorm(1:3),xaxt="n",xlab="")
> > > > plot(rnorm(1:3))
> > > >
> > > > This created two charts, one on top of the other, but there is too
> much
> > > > space between them. Does anyone know how to elimiate the space in
> > between
> > > > the charts?
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Tom
> > > >
> > > >        [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > [hidden email] 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.
> > > >
> > >
> > >
> > >
> > > --
> > > Jim Holtman
> > > Cincinnati, OH
> > > +1 513 646 9390
> > >
> > > What is the problem you are trying to solve?
> > >
> >
> >
> >
> > --
> > Tom
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>



--
Tom

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.