[R] Grid Points
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Aug 21 04:06:21 CEST 2006
That's the default. See the relation subargument to scales
if you want them different.
e.g.
library(lattice)
y <- c(601:700, seq(6510,7000, by=10))
x <- c(601:700, 601:650)
g <- rep(1:2, c(100, 50))
xyplot(y ~ x | g)
On 8/20/06, Anupam Tyagi <anuptyagi at yahoo.com> wrote:
> Thanks. How do I retain the same scale of grid.points
> from one panel to next even if the scale of the data
> changes? For example: c(seq(601:700),seq(6510,7000,
> by=10)) ~ seq(601:700) | gl(2,50).
>
>
> --- Gabor Grothendieck <ggrothendieck at gmail.com>
> wrote:
>
> > Try this. gl(2,50) is such that the first 50 points
> > are series 1
> > and the second 50 points are series 2. The scales=
> > argument
> > defines the positions of the tick marks and the
> > xlim= argument
> > defines the x axis limits. The layout puts the
> > panels on top
> > of each other rather than side by side. strip =
> > FALSE eliminates
> > the strip above each panel. type= says we want
> > lines. The
> > panel function puts points at the grid locations in
> > each panel
> > and then calls xyplot to plot the lines.
> >
> > library(lattice)
> > library(grid)
> >
> > x <- 601:700
> > at <- seq(500, 800, 50)
> > xyplot(x ~ x | gl(2, 50), scales = list(at = at),
> > xlim = c(500, 700),
> > layout = 1:2, strip = FALSE, type = "l",
> > panel = function(...) {
> > grid.points(at, unit(rep(.01, length(at)),
> > "npc"),
> > pch = 20, size = unit(.2, "char"))
> > panel.xyplot(...)
> > })
> >
> >
> > On 8/20/06, Anupam Tyagi <AnupTyagi at yahoo.com>
> > wrote:
> > > How do I put grid points (not grid lines) as the
> > base layer of an xyplot?
> > >
> > > Is there a way to vary the interval at which x and
> > y grid points are placed?
> > >
> > > Is it possible to start a graph so that Y axis
> > begins at 500 and ends at 800? I
> > > am only interested in focusing on the relative
> > distance between the points whose
> > > values are between 500 and 800, but not their
> > relative distance from zero.
> > >
> > > Is there a way in R to draw two graphs so that
> > that "share" the same X axis, but
> > > without the gap that mfrow() creates? The origin
> > of the top graph should be
> > > where the Y-axis of the bottom graph ends. It will
> > be useful for what I am
> > > trying to do to have the X axis of the top graph
> > be invisible.
> > >
> > > Anupam.
> > >
> > > ______________________________________________
> > > R-help at 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.
> > >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
More information about the R-help
mailing list