An example will be like this:
The x, y coordinate of point (1, -1) are extended to the x, y axes. Right now, I am just adding 2 dotted lines y = 1 and x = -1 by function xline
and yline
from the package fields
. However, this does not work when the point I want to mark is something like (0.5, -0.5). Then the corresponding values are not already included in the axis. In this case, the x axis should have label -1, 0, 0.5, 1, 2, 3 but I am missing 0.5 here. How do I fix it?
Edit: For example, suppose I plotted the parabola y = (x - 0.5)^2 - 0.5
quadratic <- function (x) {
return((x - 0.5)^2 - 0.5)
}
curve(quadratic, from = -1, to = 2)
How do I mark the coordinate of the vertex like the example in the picture?