I am trying to move the position of the label in a donut chart to be at the right side of the chart but I am not able to do it. I am using ggplot and ggrepel to make the graph.
library(ggplot2)
library(ggrepel)
expenditurePie = data.frame(
value = c(98,2),
area = c("A","B"),
label = c("","This is a label"))
ggplot(expenditurePie, aes(y=value, fill = area, label = label)) +
geom_bar(aes(x = 4), stat = "identity", show.legend = F) +
geom_text_repel(size = 5, x= 4, point.padding = unit(1.8, "lines"), direction = "x") +
xlim(0.5, 4.5) +
annotate(geom = "text", x=0.5, y=0, label = "24 444", size = 16, color = "grey") +
scale_fill_manual(values = c(A = "grey", B = "black")) +
coord_polar(theta = "y", start = 1) +
theme_void() +
theme(legend.position = 'none')
The image below is the result of the code above:
But the image below shows what I need:
How can I do it? Thanks.