I was trying to plot a pie char using ggplot2. The code is pasted as following
df <- data.frame(
category = LETTERS[1 : 14],
count = c(86, 2, 6, 315, 98, 140, 48, 167, 226, 269, 2, 70, 3, 112)
)
ggplot(df,
aes(x = "", y = count, fill = category)) +
geom_bar(stat = "identity", width = 1) +
geom_text(aes(label = count),
position = position_stack(vjust = 0.5)) +
coord_polar("y", start = 0)
And the output is shown as the following picture:
May I know how to set the labels to avoid overlapping? Thank you :)
