Я пытаюсь затенять область под кривой в R. Я не могу понять все правильно, и я не знаю, почему. Кривая определяетсяТень области под кривой
# Define the Mean and Stdev
mean=1152
sd=84
# Create x and y to be plotted
# x is a sequence of numbers shifted to the mean with the width of sd.
# The sequence x includes enough values to show +/-3.5 standard deviations in the data set.
# y is a normal distribution for x
x <- seq(-3.5,3.5,length=100)*sd + mean
y <- dnorm(x,mean,sd)
Участок
# Plot x vs. y as a line graph
plot(x, y, type="l")
код, я использую, чтобы попытаться цвета под кривой, где х> = 1250
polygon(c(x[x>=1250], max(x)), c(y[x==max(x)], y[x>=1250]), col="red")
но вот в результате я получаю Как правильно покрасить участок под кривой, где x> = 1250