如何绘制穿过某些点的平滑曲线 [英] How to draw a smooth curve passing through some points

查看:98
本文介绍了如何绘制穿过某些点的平滑曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

plot(rnorm(120), rnorm(120), col="darkblue", pch=16, xlim=c(-3,3), ylim=c(-4,4))
points(rnorm(120,-1,1), rnorm(120,2,1), col="darkred", pch=16)
points(c(-1,-1.5,-3), c(4,2,0), pch=3, cex=3)

我想通过绘制一条穿过一组点的平滑曲线来描绘图形的一部分,我可以定义3-4组点,但我不能定义一个功能。我想在R(而不是GIMP)中执行此操作,因为我想以SVG的身份提交。我想实现的是以下

I want to delineate a part of a graph, by drawing a smooth curve passing through a set of points.I can define 3-4 set of points but i cannot define a function. I would like to do this in R (as opposed to GIMP) as I would like to submit as SVG. What I would like to achieve is the following

这可能吗?我知道这不是一个复杂的图形问题,但是任何基本的R解决方案都可以。

Is this possible? I know this is not a sophisticated graphing question but any base R solution will do.

推荐答案

如果我理解正确的问题,那么通过控制点绘制样条线就可以完成:

if I understood the question right, drawing a spline through control points should do the job:

xspline(c(-1,-1.5,-3), c(4,2,0), shape = -1)

这篇关于如何绘制穿过某些点的平滑曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆