title: ggplot pie chart labeling
body: <p>I am struggling with getting the pie chart labels correct. Looked around and thought that I could easily implement what <a href="http://mathematicalcoffee.blogspot.com/2014/06/ggpie-pie-graphs-in-ggplot2.html" rel="noreferrer">mathematicalCoffee</a> did. So far I have this code:</p>
  
  <pre><code>ltr = LETTERS[seq( from = 1, to = 26)]
  
  wght = runif(length(ltr))
  wght = wght/sum(wght)
  wght = round(wght, digits = 2)
  
  alloc = as.data.frame(cbind(ltr, wght))
  alloc$wght = as.numeric(as.character(alloc$wght))
  
  ggpie &lt;- function (dat, by, totals) {
    ggplot(dat, aes_string(x=factor(1), y=totals, fill=by)) +
      geom_bar(stat='identity', color='black') +
      guides(fill=guide_legend(override.aes=list(colour=NA))) +
      coord_polar(theta='y') +
      theme(axis.ticks=element_blank(),
            axis.text.y=element_blank(),
            axis.text.x=element_text(colour='black'),
            axis.title=element_blank()) +
      ## scale_fill_brewer(palette = "GnBu") +
      scale_y_continuous(breaks=cumsum(dat[[totals]]) - dat[[totals]] / 2, labels=paste(dat[[by]], ":", dat[[totals]]))    
  }
  
  AA = ggpie(alloc, by = "ltr", totals = "wght") +
    ggtitle("Letter weights")
  
  AA
  </code></pre>
  
  <p>The resulting pie chart:<a href="https://i.stack.imgur.com/N4EL0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N4EL0.png" alt="Pie"></a></p>
  
  <p>Is there any way to generate something like this, for example:</p>
  
  <p><a href="https://i.stack.imgur.com/tkmJT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tkmJT.png" alt="CoolPie"></a></p>
  
  <p><strong>Update for suggested dup</strong> - I think that thread is more about alternatives to pie charts and why pie charts are bad. I would like to stick to pie charts and want to find a solution to handling labels correctly/user-friendly.</p>