r语言 legend 不显示也不报错如何修改让它显示出来

# Set up our time increment and our vector (array) of x (time) values
deltaX = 1              # years
maxX = 100             # years
x = seq(0,maxX,deltaX)  # years
# Annual growth rate of the investment
r = 0.15
c = 0.08
# A vector to hold the value of the investment
P = vector(length=length(x)) 
# Initial value of the investment
P[1] = 400
P_Max = 5000

# no fishing
for (i in 2:length(x)) {
  P[i] = P[i-deltaX] + r*deltaX*(1-P[i-deltaX]/P_Max)*P[i-deltaX]
}
plot(x = x, y = P, type = "l", xlab="Time (years)",ylab="number of fish",col="green")

# before
for (i in 2:length(x)) {
  P_e  = P[i-deltaX]*(1-c)
  P[i] = P_e + r*deltaX*(1-P_e/P_Max)*P_e
}
lines(x = x, y = P, type = "l",col="red")

# after
for (i in 2:length(x)) {
  P[i] = P[i-deltaX] + r*deltaX*(1-P[i-deltaX]/P_Max)*P[i-deltaX]
  P[i] = P[i]*(1-c)
}
lines(x = x, y = P, type = "l", col="blue")

legend(x=1,y=95,legend = c("No fishing","Before fishing","After fishing")
       ,col=c("green","red","blue"),lty=1)


不知道为什么 legend 显示不出来请帮助解决一下

https://blog.csdn.net/xiangyong58/article/details/54579293