Re: [R] Grid Points

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun 20 Aug 2006 - 23:28:30 EST

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@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@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. Received on Sun Aug 20 23:38:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 21 Aug 2006 - 04:21:17 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.