title: Histogram/bar chart containing two variables in bar
body: <p>I want to make a <a href="/questions/tagged/histogram" class="post-tag" title="show questions tagged &#39;histogram&#39;" rel="tag">histogram</a> / bar chart that looks similar to the plot below:</p>
  
  <p><img src="https://i.stack.imgur.com/DtWzu.png" alt="Click here"></p>
  
  <p>I have the following code</p>
  
  <pre><code>d1 &lt;- read.table("Session_data_TU2010AND15.csv", header = TRUE, sep = ";")
  d &lt;- d1[,c("IncHouseh","HousehNumcars")]
  </code></pre>
  
  <p>The first variable <code>IncHouseh</code> is the income of different households. These should be shown in intervals on the x-axis, while <code>HousehNumcars</code> (the number of cars in household) should be the percentage shown in the bar for each interval. </p>
  
  <p>The data <strong>d</strong> looks like this, however with more than 20000 rows:</p>
  
  <pre><code>      IncHouseh HousehNumcars
  1           800             2
  2           384             2
  4           638             1
  5           580             2
  6           700             2
  7           744             2
  8           560             1
  9           500             1
  10          686             1
  11          310             1
  12          510             1
  13          648             2
  14          372             1
  15          542             1
  </code></pre>
  
  <p>As I am new to <a href="/questions/tagged/r" class="post-tag" title="show questions tagged &#39;r&#39;" rel="tag">r</a>, I find it very difficult to be able to illustrate something similar to the link provided above. Thanks for your help!</p>
  
  <p>EDIT: After following massisenergy's code below (big thanks), I've managed to get this figure (which is correct):</p>
  
  <p><a href="https://i.stack.imgur.com/lT1XG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lT1XG.png" alt="enter image description here"></a></p>