Package: plotdigitizer
A Python3 command line utility to digitize plotsThis utility is useful when you have a lot of similar plots that needs to be
digitized such as EEG, ECG recordings. See examples below.Feel free to contact me for commercial work that may require optimizing this
pipeline for your use case. Please send a sample plot.For occasional use, have a look atWebPlotDigitizerby Ankit Rohatagi.Installation$ python3 -m pip install plotdigitizer
$ plotdigitizer --helpPreparing imageCrop the image and leave only axis and trajectories. I usegthumbutility on Linux. You can also use imagemagick or gimp.Following image is from MacFadden and Koshland, PNAS 1990 after trimming. One
can also remove top and right axis.Runplotdigitizer./figures/trimmed.png-p0,0-p10,0-p0,1We need at least three points (-poption) to map axes onto the image.  In the example
above, these are0,0(where x-axis and y-axis intesect) ,10,0(a point on
x-axis) and0,1(a point on y-axis). To map these points on the image, you
will be asked to click on these points on the image.Make sure to click in
the same order and click on the points as precisely as you could. Any error in
this step will propagate.If you don't have0,0in your image, you have to provide
4 points: 2 on x-axis and 2 on y-axis.The data-points will be dumped to a csv file specified by--output /path/to/file.csv.If--plot output.pngis passed, a plot of the extracted data-points will be
saved tooutput.png. This requiresmatplotlib. Very useful when debugging/testing.Notice the error near the right y-axis.Using in batch modeYou can pass the coordinates of points in the image at the command prompt.
This allows to run in the batch mode without any need for the user to click on
the image.plotdigitizer./figures/trimmed.png-p0,0-p20,0-p0,1-l22,295-l142,295-l22,215--plotoutput.pngHow to find coordinates of axes pointsIn the example above, point0,0is mapped to coordinate22,295i.e., the
data point0,0is on the 22nd row and 295th column of the image (assuming that bottom left
of the image is first row, first column(0,0)). I have included an utilityplotdigitizer-locate(scriptplotdigitizer/locate.py) which you can use to
find the coordinates of points.$plotdigitizer-locatefigures/trimmed.pngor, by directly using the script:$python3plotdigitizer/locate.pyfigures/trimmed.pngThis command opens the image in a simple window. You can click on a point and
its coordinate will be written on the image itself. Note them down.ExamplesBase examplesplotdigitizerfigures/graphs_1.png\-p1,0-p6,0-p0,3\-l165,160-l599,160-l85,60\--plotfigures/graphs_1.result.png\--preprocessLight gridsplotdigitizer  figures/ECGImage.png \
		-p 1,0 -p 5,0 -p 0,1 \
        -l 290,337 -l 1306,338 -l 106,83 \
		--plot figures/ECGImage.result.pngWith gridsplotdigitizer  figures/graph_with_grid.png \
		-p 200,0 -p 1000,0 -p 0,50 \
        -l 269,69 -l 1789,69 -l 82,542 \
		--plot figures/graph_with_grid.result.pngImage credit: Yang yi, WangNote that legend was not removed in the original figure and it has screwed up
the detection below it.LimitationsCurrently this script has following limitations:Background must not be transparent. It might work with transparent background but
I've not tested it.Only b/w images are supported for now. Color images will be converted to grayscale upon reading.One image should have only one trajectory.Need helpOpen an issue and please attach the sample plot.Related projects by othersWebPlotDigitizerby Ankit
Rohatagi is very versatile.Notesgrapvhiz version 2.47.2 is broken for some xml files. Seehttps://forum.graphviz.org/t/assert-sz-2-in-convertsptoroute/689. Please use a
different version.