Re: [R] adding lines to multiple plot

From: Ben Bolker <>
Date: Wed, 30 Jul 2008 14:56:27 +0000 (UTC)

Gary W <g.watmough <at>> writes:

> Hi ben
> Thanks for that, the density lines have now worked, however i was hoping
> that the labels would be the names of the columns in my original data set
> not numeric. any advice how to do this?
> gary w

mapply(function(v,n) {

    hist(v,prob=TRUE,main=paste("Histogram of",n),xlab=n)


  Or the loop equivalent.

  There are also slick ways of doing this with the lattice package (and getting a nice one-page layout of your graphs), if you "melt" your data frame first with the command from the reshape package.

  Ben Bolker mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jul 2008 - 14:58:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jul 2008 - 16:32:55 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive