[R] Rotated viewports in Grid

Gustaf Rydevik gustaf.rydevik at gmail.com
Fri Oct 26 13:02:11 CEST 2007


On 10/25/07, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:
> On 10/24/07, Paul Murrell <paul at stat.auckland.ac.nz> wrote:
> > Hi
> >
> >
> > Gustaf Rydevik wrote:
> > > Hi all,
> > >
> > > I'm trying to generate a plot containing a scatterplot, with marginal
> > > densityplots for x and y.
> > > However, when I try to generate a vertical densityplot, I get the
> > > message "warning: can't clip to rotated viewport", and nothing shows
> > > up. I'm probably misunderstanding how viewports are meant to be used,
> > > so if someone could give me a hint, I'd be most grateful.
> > > my system is R 2.5.0 (stuck, and can't upgrade for now) and windoms xp.
> >
> >
> > The warning says it all unfortunately;  R only clips to rectangular
> > regions, so if you take a rectangle (viewport) and rotate it, and try to
> > clip to it, R can't cope (it's lattice that is trying to clip to some of
> > its viewports BTW).
> >
> > Of course, R could be slightly smarter and check whether the rotated
> > rectangle is still a rectangle (aligned with the x- and y-axes).  I will
> > look at a fix for this in the development version of R.
> >
> > Unfortunately, there are still some problems with your example, because ...
> >
......

> > If it was me, I would be starting to think about writing something from
> > scratch in grid at this point ...
>
> I used essentially the problem for a guest lecture once, and the
> solution is outlined in
>
> http://www.stat.wisc.edu/~deepayan/771/rgraphics.pdf
>
> YMMV.
>
> -Deepayan
>

A big thanks Deepayan,

Thanks to your excellent tutorial, everything fell into place!

Best regards,

Gustaf

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



More information about the R-help mailing list