I have a plot where I need to delete the decimals from the percentage numbers. The data is already rounded (two decimals), an example of the data:
> head(df$X)
[1] 0.05 0.28 0.08 0.19 0.33
And then I plot it, using scale_x_continuous()
to transform it to percentage format, but as you can see in the image below they still have one decimal and I need those numbers without decimals.
This is the code for the graph:
ggplot(df, aes(x=df$X, y=DF$Y)) +
geom_point(
colour="red",
size=5
) +
geom_text(label=df$Label, vjust=-2, family="sans", fontface="bold") +
labs(x="X", y="Y") + xlim(-1,1) + ylim(-1,1) + scale_x_continuous(labels=scales::percent) + scale_y_continuous(labels=scales::percent)
The closest answer I have found is this one, but I don't need to paste the "%" symbol as I already have it.