尽管已尝试过多种类型的线,但我无法得到相同的结果.以下是我需要线条的方式:

这就是我到目前为止得到它的方式(我坚持):

这是我的代码:
myData <- read.csv(file.choose(), header = TRUE)
require(ggplot2)
g <- ggplot(myData, aes(speed, resp))
g + geom_point(aes(color = padlen, shape = padlen)) +
geom_smooth(method = "lm", formula = y ~ splines::bs(x, df = 4, degree = 2), se = FALSE, aes(color = padlen), linetype = "solid", size = 1) +
scale_color_manual(values = c("red", "black")) +
scale_shape_manual(values = c(2, 1))
Run Code Online (Sandbox Code Playgroud)
这是数据库(dput):
myData <- structure(list(resp = c(0, 0.125, 0.583333333, 1, 0.958333333,
1, 0, 0.041666667, 0.25, 0.916666667, 1, 1), padlen = structure(c(2L, …Run Code Online (Sandbox Code Playgroud)