I have the following dataframe:
df <- data.frame(product = c("a", "b", "c", "d"),
count = c(3, 4, 6, 7),
name = c("ball", "pen", "notebook", "pencil"))
ggplot(df, aes(x = "", y = count, fill = product)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
Is it possible to make the legend with information of two columns? I mean, I would like to make it like: a - ball; b - pen; c - notebook; d - pencil.
I know I can merge the columns using stringr::str_c and make a new legend like this, but I would like to use a more elegant solution.

