example plot我正在绘制一些数据。目前正试图让图表在x轴上只有自然数。怎么可能?在示例中,我想知道如何删除值1.2 1.4 1.6 1.8
谢谢
我会想象使用scale_x_continuous(breaks = c(1,2))的例子。
scale_x_continuous(breaks = c(1,2))
x = sample(1:2, 1000, replace = T) y = sample(1:6, 1000, replace = T) df = data.frame(x, y) df %>% ggplot(aes(x = x, y = y)) + geom_point() + scale_x_continuous(breaks = c(1,2))
这会产生这样的情节。