我试图使用以下代码绘制一个简单的图形;
person5.getAge();
然后我尝试在情节中添加一个图例
plot(y = Et, x = t, type = "l", col = 1,
xlab = "Time", ylab= "Equity ($)",
main = "Figure 1–3: Randomly Generated Equity Curves")
grid()
abline(h = 10000)
lines(y = Et2, x = t, col = 2)
lines(y = Eb, x = t, col = 8)
我获得的结果如下:
我哪里错了?
编辑1:我重新启动了R studio并重新运行了这些图,得到了以下结果。
编辑2:可重复的代码:
legend(x = "topleft", col = c(1,2,8), lwd = 2, legend = c("Curve 1",
"Curve 2",
"SPY"))
上面的代码是我为了生成上面的图而运行的代码。如果您能够运行它并得到相同的错误,请告诉我。