Pie chart legend problems

Hello Rstudio community ,
I would like to know how I can remove text in color square legend with geom_label _repel

My code :
df <- data.frame(
group=LETTERS[1:5],
value=c(13,7,9,21,2))
palette2=c("#cccccc", "#99ccff", "#99ccff","#99ffff","#99ffcc","#ccff99","#ffff66","#ff9999","#ff99cc","#ff99ff", "#ffccff")

ggplot(df, aes(x="", y= value, fill= group)) +
geom_bar(stat="identity", color ="white") +
geom_label_repel(aes(x = 0.85, label = paste0(value, "%")), position = position_stack(vjust = 0.8195), family = "Times New Roman", fontface= "bold" ) +
coord_polar("y", start=0) +
scale_fill_manual(values= palette2) +
theme_void() +
theme(legend.text = element_text(family = "Times New Roman", size = 10))

Expected result : ( here it is with geom_text_repel)

Thank you for your help

you can add "show.legend = FALSE" to the geom_label_repel function.

 geom_label_repel(aes(x = 0.85, label = paste0(value, "%")), 
                   position = position_stack(vjust = 0.8195), 
                   family = "Times New Roman", fontface= "bold",
                   show.legend = FALSE)

Thank u ! :slight_smile: it works

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.