[R] user coordinates and rug plots in lattice graphics

Paul Murrell p.murrell at auckland.ac.nz
Tue Apr 9 00:37:56 CEST 2002


Hi


> "Paul Murrell" <p.murrell at auckland.ac.nz> writes:
>
> >      # rug lines are 3mm high
> >      xyplot(y~x|f,
> >             panel = function(x,y,...) {
> >               panel.xyplot(x,y,...)
> >               grid.segments(x, unit(0, "npc"), x, unit(3, "mm"),
> >                             default.units="native")
> >          })
> >      # rug lines are 1/20th of the height of the plot
> >      xyplot(y~x|f,
> >             panel = function(x,y,...) {
> >               panel.xyplot(x,y,...)
> >               grid.segments(x, unit(0, "npc"), x, unit(0.05, "npc"),
> >                             default.units="native")
> >          })
> >
> > ... of course, the downside is that you have to encounter the raw grid
> > functions to do this.
>
> Sorry for butting in (and possibly revealing my ignorance about the
> inner workings of grid and lattice), but wouldn't lines of text be a
> natural unit here?


If you like.  Lines of text are possible too ...

     # rug lines are half a line of text in height
     xyplot(y~x|f,
            panel = function(x,y,...) {
              panel.xyplot(x,y,...)
              grid.segments(x, unit(0, "npc"), x, unit(0.5, "lines"),
                            default.units="native")
         })

... my main point is that you can choose which one you prefer if you go down
to the low-level grid functions.

Paul


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list