[R] labeling panels in lattice plots

Coltrey Mather r-help at cowsgomoo.org
Tue Mar 31 21:14:08 CEST 2009


Converting rain.stats$year to a factor yields the results you seem to want:

xyplot(rain.stats$min+ rain.stats$max + rain.stats$ave ~
rain.stats$month |as.factor(rain.stats$year),
           lty = 1,  data = rain.stats,  type = c("l","l", "l"), col =
c("red", "blue", "green"), distribute.type = TRUE,
           main = "Annual Monthly Minimum, Average and Maximum PPT")


On Tue, Mar 31, 2009 at 08:28,  <Steve_Friedman at nps.gov> wrote:
>
> I am using windows XP with R 2.8.1
>
>
> I am generating a lattice plot of annual rain patterns using the following
> function:
>
>
>>  xyplot(rain.stats$min+ rain.stats$max + rain.stats$ave ~
> rain.stats$month |rain.stats$year,
>            lty = 1,  data = rain.stats,  type = c("l","l", "l"), col =
> c("red", "blue", "green"), distribute.type = TRUE,
>            main = "Annual Monthly Minimum, Average and Maximum PPT")
>
>
> Each panel is labels with "rain.stats$year"  instead of the actual value
> referenced by this variable.
>
> the data.frame I'm using has the following form (year values range from
> 1965 to 2000 and month from 1 to 12).
>
>> dim(rain.stats)
>> 432 6
>
>>rain.stats[1:10,]
>   year month X2    min    max       ave
> 1  1965     1  1 0.0000 1.9196 0.3650112
> 2  1966     1  1 2.1483 4.9615 3.5247034
> 3  1967     1  1 0.4038 3.9145 1.7133045
> 4  1968     1  1 0.2033 3.2119 1.1844769
> 5  1969     1  1 1.2533 5.6226 2.9505545
> 6  1970     1  1 0.9142 3.8861 2.6248453
> 7  1971     1  1 0.1191 1.6109 0.6570289
> 8  1972     1  1 0.2309 2.9380 0.9259674
> 9  1973     1  1 0.9471 3.6342 1.9019848
> 10 1974     1  1 0.1739 9.0225 1.0672980
>
>
> The plot illustrates exactly what I'm after with the exception of the panel
> labels.  I'm following an example in the Lattice Book by Deepayan Sarkar
> (which I find very informative  - thanks), but I'm not getting the results
> as per the example.
>
> Can anyone offer a solution?
>
> Thanks in advance.
>
> Steve
>
>
>
>
>
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> R-help at r-project.org 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.
>
>




More information about the R-help mailing list