I will give you an example using the mtcars
dataset. To change the y-axis decimals to what you want, you should use the scales
package which has the function number_format
. If you run the following command number_format(accuracy = 0.1)
in the labels of scale_y_continuous
you will get the right decimals. You can use the following code as an example:
library(tidyverse)
library(scales)
mtcars %>%
ggplot(aes(x = mpg)) +
geom_histogram(aes(y=..count../sum(..count..))) +
ylab("Proportion") +
scale_y_continuous(
labels = scales::number_format(accuracy = 0.1))
Output:

As you can see, the decimals for the y-axis are in the right format.