[R] plotting with a table right under it

Jim Lemon jim at bitwrit.com.au
Sun Sep 28 12:36:24 CEST 2008


david8373 wrote:
> Hi guys,
>
> I'm new to R and this might be a basic question. I want to have a plot with
> a table right under it containing all the data in the plot. Is that possible
> in R? How do to it?
>
>   
Hi Yuhan,
Try this:

library(plotrix)
par(mfrow=c(2,1))
x<-rnorm(10)
y<-rnorm(10)
plot(x,y)
plot(0,xlim=c(-1,1),ylim=c(-1,1),type="n",
 axes=FALSE,xlab="",ylab="")
addtable2plot(-1,0.3,matrix(round(c(x,y),2),
 nrow=2,byrow=TRUE),
 display.colnames=FALSE)

Jim



More information about the R-help mailing list