如何用ggplot2每0.1绘制一次小网格?

时间:2017-05-09 05:58:54

标签: r ggplot2

例如,对于x轴和y轴,我有一个0 - 1的图。我想每0.1秒绘制panel.grid.minor。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

你在找这样的东西吗?

library(ggplot2)

xy <- data.frame(x = runif(10), y = runif(10))

mybreaks <- seq(0, 1, by = 0.1)

ggplot(xy, aes(x = x, y = y)) +
  theme_bw() +
  geom_point() +
  scale_x_continuous(breaks = mybreaks) +
  scale_y_continuous(breaks = mybreaks)

enter image description here