[R] Lattice graphs: lines, symbols and strips
djw1005 at cam.ac.uk
Tue Jul 8 15:07:02 CEST 2003
> 3. How can I make that the symbol within the graph varies with two
> variables, for example when it is good I want to put a open circle and when
> it is bad a closed circle or for example, that each point gets the number
> of samples..., but this changes throughtout the graphs...
It's not clear to me what you mean. Perhaps you can achieve something like
this with groups and subscripts. The subscripts argument to the panel (or
panel.groups) function says which of the points are about to be plotted.
pch = ifelse(currentGroup=="good","+","*")
You should define the groups parameter g beforehand, to specify for each
point whether it is "good" or "bad".
> 1. How can I introduce different lines in different graphs, from the same
> page? For example, in the upper row of graphs, I would like to have a line
> at 0.5, in the middle one at 0.3, and in the lower at 0.1. I am using
> panel.abline, but I can only make it appear in all the graphs, not in some
> of tham only...
The subscripts argument can help again here.
df <- data.frame(x=rnorm(10),y=rnorm(10),p=1+rbinom(10,2,.6))
liney <- c(.5,.3,.1)
currentPanel = unique(df$p[subscripts])
I've referred back to the original data frame, so that from the subscripts
argument I can work out which values of the panel variable I'm plotting.
(There is also a panel.number argument, but I don't like to use it,
because it's hard to remember how it relates to the value of the panel
> 4. I have two series of points, and would like tham to be separated, not
> overlaped. I tried jitter, but it did not worked (I am using xyplot).
> 2. Is it possible that the "strips" only appear in the top of the graphics,
> once per column? and once per row? This would be very nice, because it
> could save lots of graph space...
I'd like to find this out, too.
More information about the R-help