[R] plot centered line on barplot
claudio.is at libero.it
claudio.is at libero.it
Thu Jul 19 16:12:05 CEST 2007
Dear R user,
I need plot an histogram for the occurrence of a dataset, and then add a line corresponding to the freuqnecy of another similar dataset. in order to do this i used the function
> hist_data1=hist(data1, breaks= seq(0,50,5), plot=FALSE)
> hist_data2=hist(data2, breaks= seq(0,50,5), plot=FALSE)
then I plotted the frequency
> barplot(hist_data1$density)
> lines(hist_data1$density)
but the line is shifted in respect to the center of the bars. how can I properly plot the line? another question. this is easy, how can I smooth the curve (not fit with loess of spline)?
tnx
--
Claudio
More information about the R-help
mailing list