[R] Three plots with logged X-axis in the same plot

Duncan Murdoch murdoch.duncan at gmail.com
Thu May 16 15:25:19 CEST 2013


On 16/05/2013 7:50 AM, Öhagen Patrik wrote:
> I have, say, three plots with several medical terms on the y-axis plotted against HR's on a log-scaled x-axis. In order to highlight the time profile for the different plots, I would like to "merge" (put them next to each other, if that makes sense) together the log scaled x-axises and present the data in a single plot.
>
> How to do it? Using par(mfrow=c(1,3)) seems to waste too much printing area.
You can change the margins using par(mar=).  If you want things closer 
together, shrink them.  You might also want to leave off the boxes 
around the plots; use bty="n" for that.

For example,

x <- rnorm(100)
oldmargins <- par("mar")
mar <- oldmargins
mar[c(2,4)] <- c(2.1, 0.1)  # shrink the sides
par(mar=mar, mfrow=c(1,3))
plot(x, bty="n")
plot(x, bty="n")
plot(x, bty="n")

Duncan Murdoch
>
> Any suggestions?
>
> Thank you in advance!
>
> Cheers, Patrik
>
>
> 	[[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.



More information about the R-help mailing list