I made a plot where the fill bar is on a logarithmic scale. By default, labels appear in the format 1e+01, 1e+02, etc. I chose to modify the labels using the scales package, using the label_number() function. However, the values 0.1, 10, 1000 and 100000 appear with extra decimal places. Is there any way to show these numbers without the additional decimal places?
I would like a sequence like this: 0.001, 0.1, 10, 1000, and 100000.
library(ggplot2)
library(scales)
X <- 0
Y <- 0
Z <- 10
DF <- data.frame(X, Y, Z)
ggplot(data = DF,
aes(x = X,
y = Y,
fill = Z)) +
geom_tile() +
scale_fill_distiller(palette = "YlGnBu",
trans = 'log10',
limits = c(0.001, 100000),
labels = label_number(big.mark = ""))

