0

I'm trying to do a % scale to my ggplot in R, but it comes out as over 1500%, how do I make it on a 100% scale?

At the moment it looks like this:

ggplot(numbers,aes(var)) + geom_bar(position="dodge",fill="darkgreen")+
  scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
neuron
  • 1,949
  • 1
  • 15
  • 30
  • 1
    Try with `scales::percent_format(accuracy = 1, scale = 1)`. By default scales::percent_format will scale by 100. – stefan Dec 01 '21 at 23:28
  • 1
    Can you share your data with us using `dput(numbers)` and share the rest of you code for the plot? – neuron Dec 01 '21 at 23:28
  • 1
    `geom_bar` will count the number of occurrences of each `var` level, so the lowest non-zero value it would have would be 1 or 100%. Perhaps you need to convert that to a share of the total first and then use `geom_col` or `geom_bar(stat = "identity")`. – Jon Spring Dec 01 '21 at 23:30
  • Does this do what you want? https://stackoverflow.com/questions/3695497/show-percent-instead-of-counts-in-charts-of-categorical-variables – Jon Spring Dec 01 '21 at 23:30

0 Answers0