我有一个这样的图。我对范围(-3.5,0.5)之间的微小变化感兴趣,但是,它仅占据了x轴的一小部分,因此很难解释。
我试图使用transform来记录刻度以实现更好的可视化,但是,它显然不适用于负值。
那么有什么方法可以扩展该区域以使图形看起来更好?
ggplot() + geom_line(data = Final_diction, aes(x = Final_diction[,1], y
= Final_diction[,4])) +
xlim(-3.5,20) +
geom_vline(xintercept=c(-0.5,0.5), linetype="dashed", color = "red") +
geom_vline(xintercept=c(-0.25,0.25), linetype="dashed", color = "blue") +
theme_bw() +
theme(axis.title = element_text(size = 20)) +
theme(axis.text = element_text(size = 18))
答案 0 :(得分:2)
类似这样的东西
nohide
答案 1 :(得分:1)
您可以尝试添加ggplot的xlim = c(minor value, major value)
选项,并使用更适合您的范围
类似的东西:
ggplot() + geom_line(data = Final_diction, aes(x = Final_diction[,1], y
= Final_diction[,4])) +
xlim(-3.5,20) +
geom_vline(xintercept=c(-0.5,0.5), linetype="dashed", color = "red") +
geom_vline(xintercept=c(-0.25,0.25), linetype="dashed", color = "blue") +
theme_bw() +
theme(axis.title = element_text(size = 20)) +
theme(axis.text = element_text(size = 18)) +
xlim = c(-4, 1)