Using the pie
function in R, the labels appear outside of the pie. Is there a way to place labels inside each slice of the pie chart?
f=table(LETTERS[c(rep(1,7),rep(2,10),rep(3,5))])
pie(f)
It shows how to do this with ggplot
here place-labels-on-pie-chart. Is there no way to do it with the pie
function?
Edit: In response to some comments about the use of pie charts, I'd like to elaborate my intention with them. I'm actually just using the pie chart as part of a scatterplot matrix to visualize a whole data frame for regression. The matrix is set up as follows:
- Lower panels
Sample correlation numbers with the background colored darker for higher absolute correlation. - Upper panels
- Scatterplots for numeric by numeric
- Boxplots for numeric by factor
- Diagonal panels
- Histograms with normal densities for numeric
- Pie chart for factor
See, I needed something for factors on the diagonal and decided on a pie chart. I decided to leave the labels out anyway and took off all axis labeling as well. I rather used darker colors for bigger pie slices... so perhaps it may be a bad way to display information but I think it works well for a factor variable, showing how the observations are proportioned across factor levels better than a barplot would do. The figure below describes the diabetes data set in the lars
package.