Datathief
Small utility for retrieving data from figures. Inspired by the Java package of the same name.
Installation
The usual: pip install datathief.
Usage
Unlike the Java DataThief package and similar online tools, here the user manually annotates the figure with the data points of their choosing. This makes it more transparent how the data are being read and makes the results more reproducible. However, it might be annoying for a large amount of data.
If you want to extract a lot of data, or extract data from a continuous line, you are better off using the original Java DataThief package, or one of the many online tools that do exactly this.
To use this tool, first annotate the plot by adding a single pixel at the start and end of the x-axis in a specified color that does not exist anywhere else in the image (default color: pure blue). Do the same for the y-axis (default color: pure red). Then one pixel for each data point you wish to extract (default color: pure green). This function will then return the x and y coordinates of each data point. It will warn you if too many or too few pixels are detected.
For example, running this code:
import datathief as dt
filename = 'du_fig1a_annotated.png'
xlim = [-10, 20]
ylim = [0, 15]
data = dt.datathief(filename, xlim=xlim, ylim=ylim)
On this input (NB, you might need to zoom in to see the individual pixels):
Extracts the data for this plot:
See the examples folder for more information. (Figure courtesy Du et al., https://www.medrxiv.org/content/10.1101/2020.02.19.20025452v4)
More questions? Email info@sciris.org.
Metadata
Release files for datathief 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datathief-0.3.tar.gz | 4.2 kB | Without provenance | Details for datathief-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datathief-0.3-py3-none-any.whl | Python 3 | none | any | Details for datathief-0.3-py3-none-any.whl |
Total release size: 9.4 kB
Release files / datathief-0.3.tar.gz
| Download URL | datathief-0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8a4b6a97548a8da5aaa20017ad46311b49652f643a427d8811d22b72fd36f96
|
|
BLAKE2b-256 checksum How to use checksums |
a41431a5a1b71b99458ba4ab2748e80040cb4b8b4a29700d03cbd63093d00faf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Release files / datathief-0.3-py3-none-any.whl
| Download URL | datathief-0.3-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85bed2c9771e189b3d7003778c2a4d93a851a30fd10df5b5a2307aa1b3d616ba
|
|
BLAKE2b-256 checksum How to use checksums |
a18ceee622cb78fdb715605b38ddce7cd6793f1cc03a1855b20d43c33c65f1ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Security for datathief 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.