two plots super-impose

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

two plots super-impose

Philip.He
Dear R users,

I used plot(x,y) to draw a scatter plot. I need to add another smaller
histogram on the same plot I just had. However when I used hist(y), the
histogram was on another page.

Any suggestion?

Best Regards,

Philip


        [[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: two plots super-impose

Sébastien Bihorel-3
Hi Philip,

par(new=TRUE) before your hist(y) lines should do the trick.

You may have to modify some settings in case the axes are not overlayed
perfectly.

Sebastien

[hidden email] a écrit :

> Dear R users,
>
> I used plot(x,y) to draw a scatter plot. I need to add another smaller
> histogram on the same plot I just had. However when I used hist(y), the
> histogram was on another page.
>
> Any suggestion?
>
> Best Regards,
>
> Philip
>
>
> [[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: two plots super-impose

Gregory Snow
In reply to this post by Philip.He
It's not clear exactly what you want, but you may want to look at the
layout function, or the subplot function in the TeachingDemos package.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[hidden email]
(801) 408-8111
 
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> [hidden email]
> Sent: Thursday, August 02, 2007 12:07 PM
> To: [hidden email]
> Subject: [R] two plots super-impose
>
> Dear R users,
>
> I used plot(x,y) to draw a scatter plot. I need to add
> another smaller histogram on the same plot I just had.
> However when I used hist(y), the histogram was on another page.
>
> Any suggestion?
>
> Best Regards,
>
> Philip
>
>
> [[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.