2017-04-03 64 views
-1

您好,我希望爲以下幾行創建圖例,但我不確定如何操作。將圖例添加到R中的繪圖

lines1<- lines(salesARIMAPredict$pred, lty = 5, col = "Blue") 
lines(salesARIMAPredict$pred+2*salesARIMAPredict$se, col = "Red") #Confidence Interval of 95% 
lines(salesARIMAPredict$pred-2*salesARIMAPredict$se, col = "Red") 

See Attached

非常感謝賽義夫

+0

通過用四個空格縮進來在您的帖子中設置代碼行的格式。 – JanLauGe

回答

-1

問問題之前,你應該做一些基礎研究:https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/legend.html

編輯:

爲了你我創造了這個簡單的例子:

ts.plot(ldeaths) 
lines(ldeaths+100, col ="red") 
legend("top", c("ldeaths", "+100"), col = c("black", "red"), lty = 1) 
+1

[「鏈接太棒了,但它們不應該是你答案中唯一的信息]」(https://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere -really-good-answers) – Therkel

+0

@Saif我編輯了答案,請看看它 – minem