Hi All!
I would like to either put a count associated with each section of the pie chart or put a percentage that each slice makes up of the pie.
Thanks
pie_chart_df_ex <- data.frame("Category" = c("Baseball", "Basketball", "Football", "Hockey"), "freq" = c(510, 66, 49, 21))
pie_chart <- ggplot(pie_chart_df_ex, aes (x="", y = freq, fill = factor(category))) +
geom_bar(width = 1, stat = "identity") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust=0.5)) +
labs(fill = "category",
x = NULL,
y = NULL,
title = "Pie Chart of Blue Chip Makeup")
#> Error in ggplot(pie_chart_df, aes(x = "", y = freq, fill = factor(category))): could not find function "ggplot"
pie_chart + coord_polar("y")
#> Error in eval(expr, envir, enclos): object 'pie_chart' not found