[R] Combining pairs-plot with other plot

Johannes Radinger JRadinger at gmx.at
Wed Nov 23 12:20:45 CET 2011


Hello,

I want to arrange a pairs-plot and a simple boxplot next to each other.
A similar problem was already posted here:
http://r.789695.n4.nabble.com/combining-pairs-plot-with-other-plots-in-one-output-td3946235.html
but still I don't really know how to do it...

Here a some code lines for the single plot I want to combine in the end:

######## # Some sample data for combined plots ######## 
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- rnorm(100)

df <- data.frame(x1,x2,y)

p1 <- pairs(df)
p2 <- boxplot(x1)

# layout(matrix(c(1,2), 1, 2, byrow = TRUE),widths=c(2,1))
# grid.arrange(p1,p2,nrow=1,widths=c(2,1))

I had a look in ?pairs but it seems there it is only possible to set the settings for the pairplot. But how to arrange these two different plots in one joint output? Maybe with viewports, but how to start?

Thank you,

/johannes

--



More information about the R-help mailing list