[R] adding lines to multiple plot

From: Gary W <g.watmough_at_gmail.com>
Date: Wed, 30 Jul 2008 06:11:04 -0700 (PDT)


I am trying to add density lines to multiple histograms created using R. I have managed to get all 18 lines on the last histogram in the series, however, i cannot figure out how to get each line appear on the correct histogram plot. I know in Matlab there is a hold function, is there something similar in R?

the following is the code i have used to get mutiple plots and then add all the lines to the final plot:

##find unique column names in table
## define number of unique names
##for loop required for labelling of histograms and to tell how many hist to
for(i in 1:Nvariables){
##use lapply for dataframes creates hist for each variable and labels
##important to have this outside of loop
lapply(names(variables),function(i)hist(variables[[i]],probability=T,main=paste("Histogram of",i),
for(i in 1:Nvariables){

I am pretty sure its a simple explanation, i have just run out of ideas.


gary Watmough
PhD Student
University of Southamton
School of Geography

View this message in context: http://www.nabble.com/adding-lines-to-multiple-plot-tp18732850p18732850.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 30 Jul 2008 - 13:13:12 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 - 14:32:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive