使用ggplot2指定网格线位置

时间:2015-08-18 16:39:42

标签: r

我在这里搜索过并用Google搜索试图找到这个。我正在使用ggplot2并希望指定绘制网格线的精确点。例如。而不是在x = 1处绘制一条线,我希望我的线在x = 1.5。这可能吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

使用Tabs中的breaks参数。

scale_x_continuous()

enter image description here

df <- data.frame(x = 1:15, y = jitter(1:15, factor = 10))
ggplot(df, aes(x, y)) + geom_point()

enter image description here

相关问题