[R] xyplot (lattice), strip.default

Deepayan Sarkar deepayan at stat.wisc.edu
Tue May 6 18:04:00 CEST 2003


On Tuesday 06 May 2003 03:23 am, Wladimir Eremeev wrote:
> Dear r-help,
>
>   I've got data of the following structure
> 1979  93.428747  0
> 1979  87.298608  20
> 1979  78.506340  40
> ...
> 1979  45.567890  340
> 1980  60.815289  0
> 1980  49.630904  20
> 1980  24.981362  40
> ...
>
> The first column is year and the last one is the longitude.
> I need a set of graphs showing the dependence of the middle value on
> the longitude, for each year, situated one blow the other.
> I.e.
> 1979: --...---```--``--..
> 1980: ...--``../``\...---
> ...
> etc.
>
> Here characters ---...---``` denote the curve.
> The middle value is on the vertical axis
> and the latitude is on the horizontal axis of each graph.
>
> To do this I use xyplot function from the Lattice package:
>
> xyplot(ac15$"value"~ac15$lon|year,data=ac15,
>        type="l",
>        layout=c(1,24),
>        xlab="Longitude",
>        as.table=TRUE,
>        bg="white"
>       );
>
> But I have some problems using it.
>
> Questions:
>
> 1. How to make xyplot to draw the year value in the strip above each
> graph instead of writing the word 'year'?

The simplest way would be to supply year as a factor, I think.

xyplot(value ~ lon | factor(year), data=ac15,
       type="l",
       layout=c(1,24),
       xlab="Longitude",
       as.table=TRUE)

The bg = "white" would have no effect here, as others have already pointed 
out.

Deepayan




More information about the R-help mailing list