r - 在gglot r中缩放x轴上刻度之间的距离
问题描述
我有一个这样的图表。我对范围(-3.5,0.5)之间的微小变化感兴趣,但是,它只占据了 x 轴的一小部分,因此很难解释。
我尝试使用转换来记录比例以获得更好的可视化,但是,它显然不适用于负值。
那么有没有什么方法可以扩大这个区域,让图表看起来更好看呢?
代码:
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))
解决方案
像这样的东西
library(ggforce)
library(ggolot2)
ggplot(mtcars, aes(x=mpg, y=disp, group=1)) +
geom_line() + facet_zoom(xlim = c(15, 20))
推荐阅读
- amazon-web-services - 不同环境的不同 S3 存储桶 VS 每个环境使用一个存储桶和不同的对象
- objective-c - 当片段着色器参数的数量增加时,为什么 Metal 会变慢?
- javascript - 从当前鼠标位置绘制三角形
- java - 如何从表格中获取 html 数据?
- mysql - 安全地写入文件算法的一部分(原子部分写入)
- excel - 匹配函数找不到数据
- fortran - 声明实数时,Fortran 不会创建带有“OPEN”语句的文件
- html - 如何使用html nodejs从数据库中填充日期
- javascript - TypeError:无法读取未定义的属性“CustomerId”
- python - Amazon Dax 无法检索终端节点 Traceback(最近一次调用最后一次):