title: How to plot 2 categorical variables on X-axis and two continuous variables as "fill" using ggplot2 package?
body: <p>I have a dataset that has two categorical variables, viz., <code>Year</code> and <code>Category</code> and two continuous variables <code>TotalSales</code> and <code>AverageCount</code>. </p>
  
  <pre><code>    Year    Category      TotalSales    AverageCount
  1   2013    Beverages      102074.29    22190.06
  2   2013    Condiments      55277.56    14173.73
  3   2013    Confections     36415.75    12138.58
  4   2013    Dairy Products  30337.39    24400.00
  5   2013    Seafood         53019.98    27905.25
  6   2014    Beverages       81338.06    35400.00
  7   2014    Condiments      55948.82    19981.72
  8   2014    Confections     44478.36    24710.00
  9   2014    Dairy Products  84412.36    32466.00
  10  2014    Seafood         65544.19    14565.37
  </code></pre>
  
  <p>In MS Excel, we can happily get a pivot-plot for the same table, with Year and Category as AXIS, TotalSales and AverageCount as sigma values.</p>
  
  <p><strong>Using R, how do I draw such a graph as shown in the image, <em>where the categorical variables are shown as multiple layers</em> in the same graph?</strong></p>
  
  <p><img src="https://i.stack.imgur.com/pIPP2.png" alt="enter image description here"></p>
  
  <p>P.S. One option that I could see is, by splitting the data frame into two separate dataframes (One for year 2013 and another for year 2014 in our case) and draw two graphs on one single plot, arranged in multiple rows to get the same effect. But is there any way to draw it as shown above?</p>
  
  <hr>
  
  <p>Sample data used above </p>
  
  <pre><code>dat &lt;- structure(list(Year = c(2013L, 2013L, 2013L, 2013L, 2013L, 2014L, 
  2014L, 2014L, 2014L, 2014L), Category = structure(c(1L, 2L, 3L, 
  4L, 5L, 1L, 2L, 3L, 4L, 5L), .Label = c("Beverages", "Condiments", 
  "Confections", "Dairy Products", "Seafood"), class = "factor"), 
      TotalSales = c(102074.29, 55277.56, 36415.75, 30337.39, 53019.98, 
      81338.06, 55948.82, 44478.36, 84412.36, 65544.19), AverageCount = c(22190.06, 
      14173.73, 12138.58, 24400, 27905.25, 35400, 19981.72, 24710, 
      32466, 14565.37)), .Names = c("Year", "Category", "TotalSales", 
  "AverageCount"), class = "data.frame", row.names = c(NA, -10L
  )
  </code></pre>