[R] Lattice histogram with vertical lines

Dieter Menne dieter.menne at menne-biomed.de
Tue Feb 3 09:20:25 CET 2009


David Scott <d.scott <at> auckland.ac.nz> writes:

> 
> 
> I would like to add some vertical lines to a lattice plot of histograms. 
> What I am after is a lattice version of abline(v = 1234). The lattice 
> histogram plot is just:
> 
> histogram( ~ LTSE | approach, data = arrivals)
> 

As a little variation on the histogram docs example:

histogram( ~ height | voice.part, data = singer,
          xlab = "Height (inches)", type = "density",
          panel = function(x, ...) {
              panel.histogram(x, ...)
              panel.abline(v= 70)
              panel.mathdensity(dmath = dnorm, col = "black",
                                args = list(mean=mean(x),sd=sd(x)))
          } )

 
Dieter




More information about the R-help mailing list