title: beautiful Pie Charts with R
body: <p>Let's say I have this simple data:</p>
  
  <pre><code> mydata &lt;- data.frame(group=c("A", "B", "0", "AB"), FR=c(20, 32, 32, 16))
  </code></pre>
  
  <p>If I want to create a pie chart from this dataframe I can do:</p>
  
  <pre><code> with(mydata,pie(FR, labels=paste0(as.character(group), " ", FR, "%"), radius=1))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/H3XME.png" rel="noreferrer"><img src="https://i.stack.imgur.com/H3XME.png" alt="basic pie"></a></p>
  
  <p>It's quite simple but acceptable.  </p>
  
  <p>How can I get something similar with ggplot2 or lattice?</p>
  
  <p>After much trial and error I've got</p>
  
  <pre><code>ggplot(mydata, aes(x = factor(1), y=FR,fill=factor(group)) ) + geom_bar(width = 1,stat="identity")+coord_polar(theta = "y") 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/MtCOb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MtCOb.png" alt="ggplot"></a></p>
  
  <p>It's much more complex and ugly. Isn't it supposed to be easy?
  ggplot books only give some examples and discourage from using pie charts.</p>
  
  <p>Lattice is even worse, you need many many lines to get it's scaring.</p>
  
  <p>Could anybody help me top get a nice and simple Pie chart, please?
  For example something like...</p>
  
  <p><a href="https://i.stack.imgur.com/JVEPc.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/JVEPc.jpg" alt="example1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/KIGyD.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KIGyD.jpg" alt="example2"></a></p>
  
  <p>Isn't there any R package able to do it easily, without 20 lines of code?</p>