Automatic scale with ggplot

The annotations are created by geom_text(), so you want to format the numbers in that step. One way to do that is something like:

geom_text(aes(label=paste(perf, "%")), vjust=1.6, color="white", size=3.5)

For more flexible number formatting, see the scales package

If you’d like help getting the reprex package installed and working, please open a separate topic for that question. Note that since this was about a problem in a shiny app, formatting your example with reprex would not have worked. Shiny reproducible examples are a bit more complicated to create. See this FAQ for help: Shiny debugging and reprex guide.

However, the same basic principles apply: if people can’t run your code, then in most cases they can’t figure out your problem. Here, it was impossible for anybody else to find the problem since it turned out to be in a part of the shiny app code that you didn’t include in your post. It’s not very efficient for you to have helpers stuck just guessing what might be wrong due to incomplete information, and it’s not terribly respectful of your helpers’ time, either.

1 Like