Digitize plots and extract trajectories.
Project description
# PlotDigitizer
A python (python3) script to digitize plot (Under developement)
# Flow
Remove all the text from the image. Only axis and plot should be left.
This is from MacFadden and Koshland, PNAS 1990. ![](./figures/original.png)
It should be trimmed. Ideally you should also remove the top border. You can use gimp or imagemagick or any other tool for cropping.
![](./figures/trimmed.png)
Then we run the script like this.
` ./plotdigitizer.py -i ./figures/trimmed.png -p 0,0 -p 10,0 -p 0,1 `
Option -i accepts the input file. The important options is the repeating -p options. These are the data-points. We need at least 3 of them to map the axis with pixels in image. In this example, we have given three data-points 0,0, 10,0 and 0,1. We are going to click on these three points on the image later. Make sure to click in the same order.
3. The datapoints will be dumped to a csv file. If –plot option is given from command line, it will also plot the omputed data-points. This requires matplotlib.
![](./figures/traj.png)
Notice the errors near the boxes; since we have not trimmed them.
__IMP:__ Left bottom corner of the image is (0,0).
Once you have clicked on these points, the algorithm will extract the trajectory.
If you already know the location of these coordinates, you can pass them via command line using -l options e.g.
` ./plotdigitizer.py -i ./figures/trimmed.png -p 0,0 -p 10,0 -p 0,1 -l 10,10 -l 200,20 -l 10,27 `
# Limitations
Currently 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.
You might be interested in more versatile [WebPlotDigitizer](https://automeris.io/WebPlotDigitizer/) by Ankit Rohatagi.
# Development
If you enhance the script, feel free to send a PR.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file PlotDigitizer-0.0.1.tar.gz
.
File metadata
- Download URL: PlotDigitizer-0.0.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8468ddae7785e3108f212ac36344238e84bedaff7748a42e71a89ca37095f23c |
|
MD5 | 258a7e1704a62f9754b0c5a561ae284e |
|
BLAKE2b-256 | beb8fec3b64f77c871b5c98e6210edd30524478745c2078ef6361fa9b089d0fa |
File details
Details for the file PlotDigitizer-0.0.1-py3.6.egg
.
File metadata
- Download URL: PlotDigitizer-0.0.1-py3.6.egg
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b04dd153531220036c6429804373ae72d0b04cd5395d2bd0dc444fc3e91870ec |
|
MD5 | 00d1aee5a6a161bad4a66c1d71839386 |
|
BLAKE2b-256 | 7a412b44c571757d0cf54f6d1056a2ea0cedc91e437f7455377856e2c47f8c65 |
File details
Details for the file PlotDigitizer-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: PlotDigitizer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8fc6c3cc5231bd42d411b6f6395062bb964ebf12191d29c78b0a6ad8a9f3c93 |
|
MD5 | 9c404caa3642447c9b59f270acb6db9c |
|
BLAKE2b-256 | 159396174c061163bfe021871f45ca40a8b0b34589f4a0733d66486880bbae1a |