如何绘制R中的函数曲线 [英] How to plot a function curve in R
本文介绍了如何绘制R中的函数曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以为一个函数绘制一条简单的曲线,比如
eq = function(x){x * x }
in R?
这样一个明显的问题,但我只能在stackoverflow上找到这些相关的问题,但它们都是更具体的
-
上中的R
- <数据点的顶部/stackoverflow.com/questions/1853703/plotting-functions-on-top-of-datapoints-in-r\">Plotting功能如何在R中绘制一个具有复数的函数?
- 如何绘制一个简单的分段线性函数?
- 在同一个地块绘制多个功能曲线
我希望我没有写出重复的问题。
解决方案
你的意思是这样?
> eq = function(x){x * x}
> plot(eq(1:1000),type ='l')
(或者任何数值范围是与你的功能有关)
What are the alternatives for drawing a simple curve for a function like
eq = function(x){x*x}
in R?
It sounds such an obvious question, but I could only find these related questions on stackoverflow, but they are all more specific
- Plot line function in R
- Plotting functions on top of datapoints in R
- How can I plot a function in R with complex numbers?
- How to plot a simple piecewise linear function?
- Draw more than one function curves in the same plot
I hope I didn't write a duplicate question.
解决方案
You mean like this?
> eq = function(x){x*x}
> plot(eq(1:1000), type='l')
(Or whatever range of values is relevant to your function)
这篇关于如何绘制R中的函数曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文