[R] Selecting a subplot of pairs

Deepayan Sarkar deepayan at stat.wisc.edu
Fri Jan 21 16:08:32 CET 2005


On Friday 21 January 2005 03:13, Yves Brostaux wrote:
> Hello,
>
> I'm trying to plot a set of 3 dependant variables (y) against 4
> predictors (x) in a matrix-like plot, sharing x- an y-axis for all
> the plot on the same column/line :
>
> y1/x1   y1/x2   y1/x3   y1/x4
> y2/x1   y2/x2   y2/x3   y2/x4
> y3/x1   y3/x2   y3/x3   y3/x4
>
> In fact, this plot is a rectangular selection of the result of
> pairs(), limited to the relations between x's and y's and excluding
> those within x's and y's. I managed to recreate such a plot using a
> script with layout(), axis() and so on, but I was wondering if there
> already exists a clean function for such a task, in case I would
> encounter this problem again ?

You could use xyplot from lattice as:

xyplot(y1 + y2 + y3 ~ x1 + x2 + x3 + x4, data=, outer=TRUE)

You can add relation="free" to get column and row-specific axis limits, 
but they will be shown for every panel.

Hope that helps,

Deepayan




More information about the R-help mailing list