I have a plot that shows a curve and a couple of abline
s:
The plot is created using the curve
command. I would like to add the value of the x-intercept below the x-axis . . . is this possible without using a more sophisticated graphing package?
Thanks!!!
I have a plot that shows a curve and a couple of abline
s:
The plot is created using the curve
command. I would like to add the value of the x-intercept below the x-axis . . . is this possible without using a more sophisticated graphing package?
Thanks!!!
In base R you can use mtext
to add it in. For the x-axis, side = 1
:
x_abline <- -0.25
curve(x ^ 3 - 3 * x, -2, 2)
abline(v = x_abline, col = "red", lty = 2)
mtext(x_abline, side = 1, at = x_abline)
Or axis
:
curve(x ^ 3 - 3 * x, -2, 2)
abline(v = x_abline, col = "red", lty = 2)
axis(1, x_abline)
USe axis
as shown
plot(1)
abline(v = 1.1)
axis(1, 1.1)