Open In App

Create Line Curves for Specified Equations in R Programming - curve() Function

Last Updated : 10 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
curve() function in R Language is used to draw a curve for the equation specified in the argument.
Syntax: curve(expression, to, from, col) Parameters: expression: To be curved to, from: range of curve plotting col: color of curve
Example 1: Python3 1==
# R program to create a curve

# Creating curve using curve() function
curve(x ^ 2 + x + 5, -4, 4, col ="green", ylab ="y")
Output: Example 2: Python3 1==
# R program to create a curve

# Creating curve using function
fun <- function(x) {x ^ 3 + 4}
curve(fun, -4, 4, col ="red", ylab ="y")
Output:

Next Article

Similar Reads