plot - When plotting a curve in R, a piece of the curve gets cut off, not sure why -
i trying plot formula. x approaches 0 right, y should approaching infinity, , curve should going upwards close y-axis. instead gets cut off @ y=23 or so.
my_formula = function(x){7.9*x^(-0.5)-1.3} curve(my_formula,col="red",from=0 ,to=13, xlim=c(0,13),ylim=c(0,50),axes=t, xlab=na, ylab=na)
i tried play from= parameter
, , got needed when put from=-4.8
have no idea why works. in fact x doesn't less 0, , from/to should represent range of x values, they? if explain me, amazing! thank you!
by default, curve
chooses 101 x-values within (from, to)
range, set default value of n
argument. in case means there aren't many values close enough 0 show full behaviour of function. increasing number of values plotted n=500
helps:
curve(my_formula,col="red",from=0 ,to=13, xlim=c(0,13),ylim=c(0,50),axes=t, xlab=na, ylab=na, n=500)
Comments
Post a Comment