繁体   English   中英

有什么方法可以改变 ggplot 中折线图中的 x 轴比例?

[英]Is there any way to change the x-axis scale in line-graph in ggplot?

就是它现在的样子。 这是一天中的几个小时,所以我希望它是每隔一个小时或每小时。 5 的比例并不能真正帮助视觉效果。

您可以使用scale_x_continuous沿 x 轴设置中断。 这是使用pressure数据集的示例。

library(ggplot2)

ggplot(pressure, aes(x = temperature, y = pressure)) +
  geom_line() +
  scale_x_continuous(breaks = seq(from = 0, to = 400, by = 50),
                     limits = c(0, 400)) +
  theme_bw()

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM