我有一些连续的x和y值数据。在特定的x区间内,我想让刻度增量更小,比如从50到60,断点之间的距离应该是1(50、51、52、53...59、60)。对于轴的其余部分,每10个单位增加一个刻度是可以接受的。我的期望x轴上应该有以下断点:
10,20,30,40,50,51,52,53,54,55,56,57,58,58,60,70,80,90,..190,200
我尝试过的方法:
x <- seq(1:200)
y <- seq(51, 250, by = 1)
df <- data.frame(x = x, y = y)
ggplot(data = df, aes(x, y)) +
geom_line(size=1.6)+
scale_x_continuous(breaks = c(10, 20, 30, 40, seq(50, 60, by = 2), seq(70, 200, 10)),
minor_breaks = seq(50, 60, by = 2)) +
theme(axis.text.x = element_text(size = 16),
axis.text.y = element_text(size = 16),
axis.title.x = element_text(size = 16),
axis.title.y = element_text(size = 16),
axis.ticks.x = element_line(size = 1),
axis.ticks.length = unit(0.8, "cm")) +
xlab("Time") + ylab("value")+
您看到,标签重叠了。我该如何更清晰地展示它们?