title: Adding to hist()-like bars in plot()
body: <p>I would like to add a histogram of a distribution of a variable on an already generated <code>plot()</code> window. This script is heavily customized and I can only add to it. I can't use <code>hist()</code> to plot. X-axis is on an continuous scale, Y-scale is probability [0,1] (<strong>edit:</strong> One of the y-axis is probability the other is continuous). How can I add bars to represent the distribution of this variable on the already generated <code>plot()</code>? Base-R only please</p>
  
  <p>What I have done so far is <code>plot()</code> and then do the distribution with <code>lines(hist()$breaks, hist()$density, type="h")</code> which however gives me only lines but not the box-like bars of <code>hist()</code></p>
  
  <p>From what I understand <code>boxplot()</code> won't help and <code>barplot()</code> requires factors not continuous scale variables (like I have).</p>
  
  <p><strong>UPDATE:</strong> The <code>hist(...,add=T)</code> option does not work for me. I would like to be as flexible as with in the <code>line()</code> solution (thus able to transform x and y vectors), but instead of lines to draw boxes. Any ideas?</p>