title: R-stacked-grouped barplot with different fill in R
body: <p>I have the following code:</p>
  
  <pre><code>library(ggplot2)
  
  K  &lt;- data.frame(KK=c("30", "30", "30", "30","10", "10", "10", "10"),k=c("10", "8", "5", "2","10", "8", "5", "2"), 
                 Precision=c(85.2,87.5,100,100,82.5,83.3,85.2,94.4),     
                 Recall=c(73.3,80,100,100,51.4,54.8,61.1,87.9) , 
                 Fscore=c(70.8,79.4,100,100,49.1,54.2,62.7,90.3),
                 Accuracy=c(82.2,86.7,100,100,63.3,66.7,73.3,93.3)) 
    df2 &lt;- reshape2::melt(K, 1:2)
  
     ggplot(df2, 
     aes(k, value, fill = variable)) + 
    geom_bar(stat = 'identity', position = 'dodge') +
   theme(legend.position = 'top')
  </code></pre>
  
  <p>This code gives me the following plot. <a href="https://i.stack.imgur.com/6Mthr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Mthr.png" alt="enter image description here"></a></p>
  
  <p>However, I want to get a barplot like this</p>
  
  <p><a href="https://i.stack.imgur.com/H26ay.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H26ay.jpg" alt="enter image description here"></a></p>
  
  <p>Each value of k (10,8,5,2) should be a group of bars and each colour of bar a metric. In addition, the bar from the KK value 30 should be solid and with KK of 10 stripped. I don't know if it is clear. In my output appears the values for K30, but missing with K10 merged with K30 stripped. </p>