I have checked the other questions in here but I couldn't see this problem. I have a labeling problem. Weird thing is that code is working quite OK for all labels except for one. When I checked the data set (which is something really simple), everything seems quite fine (one column with factor variables, another with numerical).
It is weird because it works OK for some other data with the same structure. However, I tried/checked everything but couldn't solve this issue. Here is the problem:
library(ggplot2)
library(ggrepel)
df = data.frame(
status = c("Oak", "maple", "walnut", "Pine"),
value = c( 47.54, 37.70, 11.48, 3.28))
ggplot(df, aes(x = "" , y = value, fill = fct_inorder(status))) +
geom_bar(width = 1, stat = "identity") +
coord_polar(theta = "y", start = 0 ) +
scale_fill_brewer(palette = "Set3", direction = -4) +
geom_label_repel(aes(label = paste0(value, "%")), size=4, show.legend = F, nudge_x = 1) +
guides(fill = guide_legend(title = "Status")) +
theme_void()
It would be great if I have at least a suggestion to try or explanation of this weird behaviour.
Apparently, with the new ggplot2 update they figured the position problem out without giving any extra position data but somehow, If you are unable to use it because of technical limitations, this might help to solve this kind of issues.