79212607

Date: 2024-11-21 19:10:44
Score: 1
Natty:
Report link

I think you're looking for this:

ggplot(df, aes(y=name, x=value, fill = cost)) +
  coord_cartesian(clip = "off") +
  geom_bar(position = "stack", stat = "identity") +
  geom_text(
    aes(label = after_stat(x), group = name), 
    stat = 'summary', fun = sum, hjust = -0.5
  )

enter image description here

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
Posted by: Michiel Duvekot