带有刻面图的x_scale_reverse错误消息

时间:2017-03-16 11:24:03

标签: r ggplot2

我有时间序列数据(每5分钟一次)。我已生成单个图并添加了矩形填充以指示反应发生前的10分钟时间。发生反应的时间为0,x轴上的最后一点是测量开始时的时间。我想反转比例,以便我的10分钟块被反转并显示在x轴的末端。

以下是我正在使用的代码:

 p3 <- ggplot(data = HR, aes(x = Time_mins, y=HR.raw, group=ID)) + 
  geom_line() +
scale_x_reverse() +
  facet_wrap(~ID) + 
  geom_line(data = HR, aes(x = Time_mins, y=HR.mean),color = "red" ) +
  annotate("rect",xmin=0, xmax=120, ymin=0, ymax=120, alpha=.1, fill="blue")
p3

我收到一条警告信息:

Error in -x : invalid argument to unary operator

enter image description here

0 个答案:

没有答案