Title: | Use Data from Published Plots in R |
---|---|
Description: | Import data from a digital image; it requires user input for calibration and to locate the data points. The end result is similar to 'DataThief' and other other programs that 'digitize' published plots or graphs. |
Authors: | Timothée Poisot [aut], Rene Sachse [aut], Jaime Ashander [aut, cre], Tal Galili [aut] |
Maintainer: | Jaime Ashander <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0.4 |
Built: | 2025-02-05 03:24:49 UTC |
Source: | https://github.com/tpoisot/digitize |
Get data from a graph by providing calibration points
The package provides one main function, digitize
, which runs functions
that 1) Read the image in and calibrate it, and 2) Digitize the data.
The first step requires user input.
(deprecated) Digitize the data
Calibrate(data, calpoints, x1, x2, y1, y2)
Calibrate(data, calpoints, x1, x2, y1, y2)
data |
output of 'DigitData' |
calpoints |
output of 'ReadAndCal' |
x1 |
X-coordinate of the leftmost x point (corrected) |
x2 |
X-coordinate of the rightmost x point (corrected) |
y1 |
Y-coordinate of the lower y point (corrected) |
y2 |
Y-coordinate of the upper y point (corrected) |
deprecated, use digitize
instead. This function corrects the data according to the
calibration information. Usage further explained at
http://lukemiller.org/index.php/2011/06/digitizing-data-from-old-plots-using-digitize/
'data' A data frame with the corrected coordinates of the points
## Not run: Calibrate(data,calpoints,x1,x2,y1,y2)
## Not run: Calibrate(data,calpoints,x1,x2,y1,y2)
(deprecated) Mark the data on an image
DigitData(col = "red", type = "p", ...)
DigitData(col = "red", type = "p", ...)
col |
color of marker as in 'par' |
type |
shape of marker as in 'par' |
... |
other args for 'locator' |
deprecated, use digitize
instead. This function waits for the user to click the points of
the coordinates. See 'graphics::locator' for more. Usage explained at
http://lukemiller.org/index.php/2011/06/digitizing-data-from-old-plots-using-digitize/
'data' A list with the coordinates of the points
digitize an image
digitize(image_filename, ..., x1, x2, y1, y2)
digitize(image_filename, ..., x1, x2, y1, y2)
image_filename |
the image file you wish to digitze |
... |
pass parameters col or type to change data calibration points |
x1 |
(optional) left-most x-axis point |
x2 |
(optional) right-most axis point |
y1 |
(optional) the lower y-axis point |
y2 |
(optional) the upper y-axis point |
Proceeds in two steps, both of which require user input from the mouse:
1) Read the image in and calibrate it
2) Digitize the data
Calibration points are optionally passed via arguments x1, x2, y1, y2. These **must be named in full** if passed.
If not specified, you are prompted to enter these in the console. Note, you don’t need to choose the end points of each axis, only two points for which you know the x or y return.
a data.frame containing the digitized data
## Not run: tmp <- tempfile() png(tmp) plot(rnorm(10) + 1:10, xlab="x", ylab="y") dev.off() mydata <- digitize(tmp) ## End(Not run)
## Not run: tmp <- tempfile() png(tmp) plot(rnorm(10) + 1:10, xlab="x", ylab="y") dev.off() mydata <- digitize(tmp) ## End(Not run)
(deprecated) Read image and calibrate
ReadAndCal(fname)
ReadAndCal(fname)
fname |
Filename of the graphic to read |
deprecated, use digitize
instead. Called for side effect of user locating points. See
'graphics::locator' for more. Usage explained at
http://lukemiller.org/index.php/2011/06/digitizing-data-from-old-plots-using-digitize/
'calpoints' List of the x and y coordinates of the calibration points
## Not run: ReadAndCal(fname)
## Not run: ReadAndCal(fname)