全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
13711 10
2015-01-25
用plot(x,y)画出散点图,发现x和y是二次函数的关系,如何画出抛物线的拟合图
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-25 13:27:54
plot(x,y,"l")
Arguments to be passed to methods, such as graphical parameters (see par). Many methods will accept the following arguments:

type
what type of plot should be drawn. Possible types are

"p" for points,

"l" for lines,

"b" for both,

"c" for the lines part alone of "b",

"o" for both ‘overplotted’,

"h" for ‘histogram’ like (or ‘high-density’) vertical lines,

"s" for stair steps,

"S" for other steps, see ‘Details’ below,

"n" for no plotting.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-25 15:02:07
358463121 发表于 2015-1-25 13:27
plot(x,y,"l")
Arguments to be passed to methods, such as graphical parameters (see par). Many metho ...
参数“l”是把所有点连起来,没办法画出二次函数的拟合曲线
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-25 15:27:38
fit <- lm(y~x+I(x^2))
plot(x,y)
lines(x,fitted(fit))


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-26 09:08:32
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-27 00:38:50
gni456 发表于 2015-1-25 15:27
fit
画不出拟合的二次曲线
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群