digitizr | R Documentation |
a wrapper for the magick package, focussed on extracting data from images containing graphs
digitizr( inputfilename = NULL, outputfilename = NULL, xvarname = NULL, yvarname = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, yscalemax = NULL, threshold = NULL, mygraphsize = 1000 )
inputfilename |
Name of the input image file. This file should contain only the graph area, not the axes, titles or legends. |
outputfilename |
Name to be used for the output image file (PNG format). |
xvarname |
Name to be used for the x variable. |
yvarname |
Name to be used for the y variable. |
xmin |
Minimum x value. |
xmax |
Maximum x value. |
ymin |
Minimum y value. |
ymax |
Maximum y value. |
yscalemax |
Maximum value to be used for the y-scale. |
threshold |
The threshold is a percentage written as a character string, e.g. "70%". Some experimentation might be needed to find the value that works best. |
mygraphsize |
The graph size in pixels. |
myinputfile <- system.file("extdata", "ari.png", package = "humblr") extracted_data <- digitizr(inputfilename=myinputfile, outputfilename="extracted_data_graph.png", xvarname="año", yvarname="millones de pasajeros", xmin=2020, xmax=2050, ymin=0.928253, ymax=4.159696, yscalemax=5, threshold="70%")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.