[R] Retrieve part of (top right corner) of a "plot.data.frame" plot?

2007-06-20 Thread Dan Bolser
Hi,

I believe this question has been asked before, but I cant find and don't
remember the answer.

The problem is simple, calling 'plot.data.frame(x)' gives a nice 'matrix of
scatterplots' for each pair of columns in x. for example;

x <-
  data.frame(a=jitter(01:20),
 b=jitter(20:01),
 c=jitter(21:40),
 d=jitter(rep(01,20)),
 e=jitter(rep(10,20)),
 f=jitter(rep(20,20))
 )

plot(x)

gives a 6 by 6 grid of scatter plots, two (upper right and lower left) for
each pair of columns in x. (I am going over these basics so that you can
understand what I mean next).

I would like to see just part of the above result, namely the nine plots in
the top right of the given plot, or;

a vs. d | a vs. e | a vs. f
b vs. d | b vs. e | b vs. f
c vs. d | c vs. e | c vs. f

I tried a number of ways to do this, but I can't find either the right
formula or the right function to get what I want.

Any suggestions you can give (especially any not involving the source code
of 'pairs') are most welcome.

Dan.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] Retrieve part of (top right corner) of a "plot.data.frame" plot?

2007-06-20 Thread Sébastien
Hi,

That is maybe not the most elegant way but you can hide some plots 
regions by add a white polygon, eg:

polygon(x=c(1,1,0,...),y=c(0,1,0,...),col=0,xpd=xpd)

Just a personnal question, can you modify the content of the "title" 
boxes without changing the names of the variables, e.g. "myParameter" 
instead of "a"?

Dan Bolser a écrit :
> Hi,
>
> I believe this question has been asked before, but I cant find and don't
> remember the answer.
>
> The problem is simple, calling 'plot.data.frame(x)' gives a nice 'matrix of
> scatterplots' for each pair of columns in x. for example;
>
> x <-
>   data.frame(a=jitter(01:20),
>  b=jitter(20:01),
>  c=jitter(21:40),
>  d=jitter(rep(01,20)),
>  e=jitter(rep(10,20)),
>  f=jitter(rep(20,20))
>  )
>
> plot(x)
>
> gives a 6 by 6 grid of scatter plots, two (upper right and lower left) for
> each pair of columns in x. (I am going over these basics so that you can
> understand what I mean next).
>
> I would like to see just part of the above result, namely the nine plots in
> the top right of the given plot, or;
>
> a vs. d | a vs. e | a vs. f
> b vs. d | b vs. e | b vs. f
> c vs. d | c vs. e | c vs. f
>
> I tried a number of ways to do this, but I can't find either the right
> formula or the right function to get what I want.
>
> Any suggestions you can give (especially any not involving the source code
> of 'pairs') are most welcome.
>
> Dan.
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch 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.
>
>
>

__
R-help@stat.math.ethz.ch 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.


Re: [R] Retrieve part of (top right corner) of a "plot.data.frame" plot?

2007-06-20 Thread Dan Bolser
On 20/06/07, Sébastien <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> That is maybe not the most elegant way but you can hide some plots
> regions by add a white polygon, eg:
>
> polygon(x=c(1,1,0,...),y=c(0,1,0,...),col=0,xpd=xpd)


Yeah, that is no good because it is the scale of the 'full' plot that is the
real problem. I want about a 4 by 4 upper right corner from a 17 by 17
matrix of plots.

I think this should be possible, for example saying something like;

pairs( x=x[,1:3], y=x[,3:6] )


*could* produce the desired behaviour (in at least a semi-logical way).


Just a personnal question, can you modify the content of the "title"
> boxes without changing the names of the variables, e.g. "myParameter"
> instead of "a"?


Yup, that is easy :-D

Try the following (on the code already given);

plot(x, labels=paste("hello\n", names(x)))


See "?pairs" for the really cool things that you can do.


Dan Bolser a écrit :
> > Hi,
> >
> > I believe this question has been asked before, but I cant find and don't
> > remember the answer.
> >
> > The problem is simple, calling 'plot.data.frame(x)' gives a nice 'matrix
> of
> > scatterplots' for each pair of columns in x. for example;
> >
> > x <-
> >   data.frame(a=jitter(01:20),
> >  b=jitter(20:01),
> >  c=jitter(21:40),
> >  d=jitter(rep(01,20)),
> >  e=jitter(rep(10,20)),
> >  f=jitter(rep(20,20))
> >  )
> >
> > plot(x)
> >
> > gives a 6 by 6 grid of scatter plots, two (upper right and lower left)
> for
> > each pair of columns in x. (I am going over these basics so that you can
> > understand what I mean next).
> >
> > I would like to see just part of the above result, namely the nine plots
> in
> > the top right of the given plot, or;
> >
> > a vs. d | a vs. e | a vs. f
> > b vs. d | b vs. e | b vs. f
> > c vs. d | c vs. e | c vs. f
> >
> > I tried a number of ways to do this, but I can't find either the right
> > formula or the right function to get what I want.
> >
> > Any suggestions you can give (especially any not involving the source
> code
> > of 'pairs') are most welcome.
> >
> > Dan.
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@stat.math.ethz.ch 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.
> >
> >
> >
>

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] Retrieve part of (top right corner) of a "plot.data.frame" plot?

2007-06-20 Thread Deepayan Sarkar
On 6/20/07, Dan Bolser <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I believe this question has been asked before, but I cant find and don't
> remember the answer.
>
> The problem is simple, calling 'plot.data.frame(x)' gives a nice 'matrix of
> scatterplots' for each pair of columns in x. for example;
>
> x <-
>   data.frame(a=jitter(01:20),
>  b=jitter(20:01),
>  c=jitter(21:40),
>  d=jitter(rep(01,20)),
>  e=jitter(rep(10,20)),
>  f=jitter(rep(20,20))
>  )
>
> plot(x)
>
> gives a 6 by 6 grid of scatter plots, two (upper right and lower left) for
> each pair of columns in x. (I am going over these basics so that you can
> understand what I mean next).
>
> I would like to see just part of the above result, namely the nine plots in
> the top right of the given plot, or;
>
> a vs. d | a vs. e | a vs. f
> b vs. d | b vs. e | b vs. f
> c vs. d | c vs. e | c vs. f
>
> I tried a number of ways to do this, but I can't find either the right
> formula or the right function to get what I want.
>
> Any suggestions you can give (especially any not involving the source code
> of 'pairs') are most welcome.

Lattice gets you close:

xyplot(a + b + c ~ d + e + f, data = x, outer = TRUE,
   scales = "free", layout = c(3, 3), aspect = 1)

The rest may or may not be simple, depending on what you want exactly.

-Deepayan

__
R-help@stat.math.ethz.ch 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.