如何覆盖ggplot2的轴格式?

Ric*_*ton 9 r ggplot2

当您选择对数刻度时,ggplot2会格式化10 ^ x之类的中断.我希望不这样做.例如,下面的代码应该显示一个刻度为1,2,5等的图形,而不是10 ^ 0,10 ^ 0.3,10 ^ 0.69等.

library(ggplot2)
dfr <- data.frame(x = 1:100, y = rlnorm(100))
breaks <- as.vector(c(1, 2, 5) %o% 10^(-1:1))
p1 <- ggplot(dfr, aes(x, y)) + geom_point() + scale_y_log10(breaks = breaks)
print(p1)
Run Code Online (Sandbox Code Playgroud)

我想添加一个formatter参数scale_y_log10可以解决这个问题,但是我不确定要在参数中添加什么,或者可以记录选项的位置.

had*_*ley 8

scale_y_log10(breaks = breaks, labels = breaks 应该做的伎俩.