强制 R 停止绘制缩写轴标签 - 例如ggplot2 中的 1e+00 [英] Force R to stop plotting abbreviated axis labels - e.g. 1e+00 in ggplot2
本文介绍了强制 R 停止绘制缩写轴标签 - 例如ggplot2 中的 1e+00的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 ggplot2 中如何停止轴标签的缩写 - 例如1e+00, 1e+01
沿 x 轴绘制一次?理想情况下,我想强制 R 显示实际值,在本例中为 1,10
.
In ggplot2 how can I stop axis labels being abbreviated - e.g. 1e+00, 1e+01
along the x axis once plotted? Ideally, I want to force R to display the actual values which in this case would be 1,10
.
非常感谢任何帮助.
推荐答案
我认为您正在寻找这个:
I think you are looking for this:
require(ggplot2)
df <- data.frame(x=seq(1, 1e9, length.out=100), y=sample(100))
# displays x-axis in scientific notation
p <- ggplot(data = df, aes(x=x, y=y)) + geom_line() + geom_point()
p
# displays as you require
require(scales)
p + scale_x_continuous(labels = comma)
这篇关于强制 R 停止绘制缩写轴标签 - 例如ggplot2 中的 1e+00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文