Calibration
So far, so good. The next step is to calibrate the graphic, by adding four calibration points of known coordinates. Because it is not always easy to know both coordinates of a point, we will use four calibration points. For the first pair, we will know the x position, and for the second pair, the y position. That allows us to place the points directly on the axis.
calpoints <- locator(n=4,type='p',pch=4,col='blue',lwd=2)
We can see the current value of the calibration points :
as.data.frame(calpoints) x y 1 139.66429 73.8975 2 336.38388 73.8975 3 58.72237 167.0254 4 58.72237 328.1680
Point’n'click
The third step is to click each point, individually, in order to get the data.
data <- locator(type='p',pch=1,col='red',lwd=1.2,cex=1.2)
After clicking all the points, you should have the following graph :
Our data are, so far :
as.data.frame(data) x y 1 104.8285 78.08303 2 138.6397 114.70636 3 171.4263 119.93826 4 205.2375 266.43158 5 238.0241 267.47796 6 270.8107 275.84901 7 302.5727 282.12729 8 336.3839 298.86939 9 370.1951 306.19405 10 401.9571 352.23481
OK, this is nearly what we want. What is left is just to write a function that will convert our data into the true coordinates.
No comments:
Post a Comment