ggplot2 y-axis ticks not showing up on a log scale
我正在尝试使用 ggplot2 创建箱线图,但无法像 ggplot2 webiste 的示例中那样显示刻度。
这里有一些水果味道的假数据:
1
2 3 4 |
apples <- data.frame(fruit=c(rep(“apple”, 30)), taste=runif(30, 30, 50)
banana <- data.frame(fruit=c(rep(“banana”, 30)), taste=runif(30, 300, 500)) orange <- data.frame(fruit=c(rep(“orange”, 30)), taste=runif(30, 3000, 5000)) fruits <- rbind(apples,banana,orange) |
如果我在 ggplot2 网站示例中进行绘图,则 y 轴刻度应类似于:
相反,我得到一个像这样的轴:
1
|
ggplot(fruits, aes(fruit, taste) ) + geom_boxplot() + scale_y_log10()
|
如何获得科学计数法的 y 轴刻度?
来源:https://www.codenong.com/9651903/