Generate a polished pie chart from a vector or a grouped data frame. Labels (optional) are placed inside the pie slices.
plot_pie(
data,
group_col = "group",
count_col = "count",
label = c("none", "count", "percent", "both"),
label_size = 4,
label_color = "black",
fill = c("#009076", "#C71E1D", "#15607A", "#FA8C00", "#18A1CD"),
title = "Pie Chart",
title_size = 14,
title_color = "black",
legend.position = "right",
preview = TRUE,
save = NULL,
return_data = FALSE
)A ggplot object or list(plot, data)
A character/factor vector or data.frame.
Group column name (for data.frame). Default: "group".
Count column name (for data.frame). Default: "count".
Type of label to display: "none", "count", "percent", or "both". Default: "none".
Label font size. Default: 4.
Label font color. Default: "black".
Fill color vector. Default: 5-color palette.
Plot title. Default: "Pie Chart".
Title font size. Default: 14.
Title color. Default: "black".
Legend position. Default: "right".
Whether to print the plot. Default: TRUE.
Optional path to save the plot (e.g., "plot.png").
If TRUE, return list(plot = ..., data = ...). Default: FALSE.