我使用以下代码创建存储利用率图表和趋势 . 我的问题是我不能让geom_line成为任何颜色,而是黑色或杂色钢蓝色 . 如果我尝试使用 color="purple" 设置颜色,我会收到

错误:提供给连续刻度的离散值

我对R编码相当新,因此我研究了错误,许多解决方案似乎都围绕编码错误或数据是错误的类类型 . Y值的数据均为数字,X值为日期值 .

我的偏好是为线条设置纯色,但每条线条的不同杂色也可以使用 .

我还包括我的数据框中的剪辑 .

data  
         Time     FC FCFree     NL NLFree  SSD SSDFree  
1  2014-05-05 179886  64722 104628 126412 6576    5264  
2  2014-05-12 180486  64122 104628 126412 6576    5264  
3  2014-05-19 182286  62322 104628 126412 6576    5264  
4  2014-05-26 184686  59922 104628 126412 6748    5092  
5  2014-06-02 185282  59326 104620 126420 6748    5092  

df80  
         date     X.Lo.80  X.Hi.80  
1  2016-02-12 152669.3677 191089.0  
2  2016-02-19 143284.9057 197909.7  
3  2016-02-26 135687.2835 202943.7  
4  2016-03-04 128999.3090 207068.0  
5  2016-03-11 122883.3810 210620.2  

df95  
         date       Lo.95    Hi.95  
1  2016-02-12 159318.5530 184439.8  
2  2016-02-19 152738.6943 188456.0  
3  2016-02-26 147327.1874 191303.8  
4  2016-03-04 142510.4670 193556.8  
5  2016-03-11 138067.7879 195435.8  

Allocat  
         Time Allocated  
1  2014-05-05    291090  
2  2014-05-12    291690  
3  2014-05-19    293490  
4  2014-05-26    296062  
5  2014-06-02    296650  

Subscribe
         date SubScribe  
1  2014-05-05  492839.0  
2  2014-05-12  486848.3  
3  2014-05-19  490117.7  
4  2014-05-26  494348.3  
5  2014-06-02  498552.3  

dfmedian
         date MedianTrend  
1  2016-02-12    171879.2  
2  2016-02-19    172480.7  
3  2016-02-26    173082.2  
4  2016-03-04    173683.7  
5  2016-03-11    174285.2  

dftrnd  
         date    Trend  
1  2016-02-12 171879.2  
2  2016-02-19 170597.3  
3  2016-02-26 169315.5  
4  2016-03-04 168033.7  
5  2016-03-11 166751.8  

TotalCap  
487488

绘图代码

ggplot() +  geom_area(data=mdata, position="stack", aes(x=Time,y=value,group=variable,fill=variable))+  
    geom_ribbon(data=df80, aes(x=date,ymin=X.Lo.80,ymax=X.Hi.80,fill="Accuracy80"))+  
    geom_ribbon(data=df95, aes(x=date,ymin=Lo.95,ymax=Hi.95,fill="Accuracy95"))+  
    geom_line(data=Subscribe, aes(x=date,y=SubScribe,fill="Subscription"))+  
    geom_line(data=Allocat, aes(x=Time,y=Allocated,fill="AllocationLine"))+  
    geom_line(data=dfmedian, aes(x=date,y=MedianTrend,fill="MedianTrend"))+  
    geom_line(data=dftrnd, aes(x=date,y=Trend,colour=Trend))+  
    geom_hline(aes(yintercept=TotalCap), colour="#990000", linetype="dashed")+  
    xlab("Date")+  
    ylab("GiB") +  
    ggtitle(PlotTitle)+  
    scale_fill_manual(values=c("Accuracy80"="gray80",  
      "Accuracy95"="lightsteelblue3",  
      "Allocated"="forestgreen",  
      "Free"="springgreen2",  
      "Trend"="steelblue4",  
      "Subscription"="black",  
      "AllocationLine"="purple",  
      "MedianTrend"="coral4",  
      "FC"="#93AA00",  
      "FCFree"="#00BA38",  
      "NL"="#00C19F",  
      "NLFree"="greenyellow",  
      "SSD"="#619CFF",  
      "SSDFree"="violet"))+  
    scale_y_continuous(labels = comma)+  
    theme(axis.text.x = element_text(angle = 90, hjust = 1))+  
    guides(variable = guide_legend(order=1), Trend = guide_legend(order=2))+  
    scale_colour_continuous(labels=comma)

enter image description here