To superimpose anything onto a barplot you just need to know the x axis
locations of the bars, then everything behaves as expected. You can find
this by writing the barplot to an object, ie:

bp <- barplot(c(1:5),beside=TRUE)

bp is now a matrix containing the actual x axis locations of the bars (in
this case 0.7, 1.9, 3.1, 4.3 and 5.5). You can now add things to this
barplot, such as:

lines(bp,1:5)

which in this case adds a line joining the tops of all the bars.

You should be able to adapt this simple example to your situation.

On 10 November 2010 10:04, casperyc <casperyc@hotmail.co.uk> wrote:

>
> Thanks！
>
> now it's just a matter of 'superposing' the density onto the barplot
>
> I am looking at the example here,
> but it does not seem to applicable to barplot.
>
> casper
> --
> View this message in context:
> http://r.789695.n4.nabble.com/how-do-i-plot-this-hist-tp3032796p3035110.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

