Plotting a function curve in R with 2 or more variables
How can I draw a curve for a function like vpd = function(k,D){exp(-k*D)} in R? I want a plot of D vs vpd (0:1) assuming k is constant. The only question I could find was How to plot a function curve in R . I've tried both of: plot.function(vpd, from=0, to=1, n=101) curve(vpd, from=0, to=1, n=101, add=FALSE, type = "l") but only get Error in -k * D : 'D' is missing UPDATE: solved it! vpd <- function(D,k=0.05){exp(-k*D)} # D is the x axis plot(vpd, from=1, to=100, ylim=0:1) While Mamoun Benghezal's answer works for functions you define yourself, there may be cases where you want to plot a