如何在time_series图中设置x轴和y轴间隔?

时间:2015-04-17 10:09:50

标签: r ggplot2 axis-labels

我有一个时间序列数据框,在下面你可以看到我的数据帧的前50行的可重现数据。

DT1 <- structure(list(Tool = c("M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", "M_01", 
    "M_01", "M_01", "M_01", "M_01", "M_01"), end = structure(c(1429156909, 
    1429157057, 1429157195, 1429158966, 1429159165, 1429159325, 1429159485, 
    1429159598, 1429159717, 1429159835, 1429159955, 1429160075, 1429160205, 
    1429160306, 1429160415, 1429160815, 1429160925, 1429161135, 1429161267, 
    1429161377, 1429161495, 1429161605, 1429161785, 1429161937, 1429162015, 
    1429162097, 1429162195, 1429162285, 1429162375, 1429162475, 1429162575, 
    1429162655, 1429162787, 1429162897, 1429162998, 1429163075, 1429163165, 
    1429163255, 1429163348, 1429163436, 1429163528, 1429163635, 1429163755, 
    1429163845, 1429163927, 1429164145, 1429164235, 1429164335, 1429164418, 
    1429164507), class = c("POSIXct", "POSIXt"), tzone = "")), .Names = c("Tool", 
    "end"), class = c("data.table", "data.frame"), row.names = c(NA, 
    -50L), .internal.selfref = <pointer: 0x00000000001d0788>)

以下是我的数据框(完整)的快速视图

>DT
     Tool                 end
  1: M_01 2015-04-16 06:01:49
  2: M_01 2015-04-16 06:04:17
  3: M_01 2015-04-16 06:06:35
  4: M_01 2015-04-16 06:36:06
  5: M_01 2015-04-16 06:39:25
 ---                         
619: M_01 2015-04-17 05:39:30
620: M_01 2015-04-17 05:44:20
621: M_01 2015-04-17 05:46:08
622: M_01 2015-04-17 05:47:18
623: M_01 2015-04-17 05:49:18

通过使用ggplot我生成了一个图表,下面是代码

blue.bold.italic.16.text <- element_text(face = "bold", color = "black", size = 16)
s <- ggplot(DT,aes(DT$end,seq_along(DT$end)))+geom_point(size=1.5, shape=2)
 s + 
  theme(axis.title.x=element_blank(), 
  axis.title.y=element_blank(),
  legend.position="none",
  axis.line = element_line(colour="black"),
  axis.text = blue.bold.italic.16.text)

my graph looks like these

enter image description here

我想知道如何为时间序列图设置间隔(x轴和y轴)。在我的图表中,我想在x轴和y轴间隔50/100

上显示每小时

在我的情况下,数据在x轴和y轴上连续增加并且没有刻度选项仅适用于离散数据

0 个答案:

没有答案