# [R] Multiple plots; single x(y) labels

Jim Lemon jim at bitwrit.com.au
Fri May 14 10:14:20 CEST 2010

```On 05/14/2010 02:04 AM, Xin Ge wrote:
> Hi All,
>
> plotting muliple plots. Here is the code:
>
> par(mfcol=c(2,2))
> plot(x<- sort(rnorm(7)), type = "s", main = "", ylab="", xlab="")
> plot(x<- sort(rnorm(27)), type = "s", main = "", ylab="", xlab="")
> plot(x<- sort(rnorm(47)), type = "s", main = "", ylab="", xlab="")
> plot(x<- sort(rnorm(67)), type = "s", main = "", ylab="", xlab="")
>
> also, how can remove x-tick lables using plot()?
>
Hi Xin,
Fortunately, this wheel is pretty easy to reinvent:

require(plotrix)
x1<-rnorm(7)
x2<-rnorm(27)
x3<-rnorm(47)
x4<-rnorm(67)
allxlim<-c(1,67)
allylim<-range(c(x1,x2,x3,x4))
panes(matrix(1:4,nrow=2,byrow=TRUE),widths=c(1.1,1),
heights=c(1,1.1))
par(mar=c(0,4,2,0))
plot(sort(x1),xlim=allxlim,ylim=allylim,type="s",
main="",ylab="",xlab="",xaxt="n")
tab.title("Plot of x1",tab.col="orange")
par(mar=c(0,0,2,1))
plot(sort(x2),xlim=allxlim,ylim=allylim,type="s",
main="",ylab="",xlab="",xaxt="n",yaxt="n")
tab.title("Plot of x2",tab.col="orange")
par(mar=c(4,4,2,0))
plot(sort(x3),xlim=allxlim,ylim=allylim,type="s",
main="",ylab="",xlab="")
tab.title("Plot of x3",tab.col="orange")
par(mar=c(4,0,2,1))
plot(sort(x4),xlim=allxlim,ylim=allylim,type="s",
main="",ylab="",xlab="",yaxt="n")
tab.title("Plot of x4",tab.col="orange")

Jim

```