GithubHelp home page GithubHelp logo

vitorlopesgarcia / plotdigitizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dilawar/plotdigitizer

0.0 0.0 0.0 217 KB

Python3 app to digitize plot (Under developement)

License: GNU General Public License v3.0

Python 98.22% Makefile 1.78%

plotdigitizer's Introduction

Build Status PyPI version

PlotDigitizer

A python (python3) script to digitize plot (Under developement)

Usage

  1. Remove all the text from the image. Only axis and plot should be left.

This is from MacFadden and Koshland, PNAS 1990.

It should be trimmed. Ideally you should also remove the top border. You can use gimp or imagemagick or any other tool for cropping.

  1. 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.

We need at least 3 of them to map the coordinate systems onto the pixel-system in the image. These points are passed by repeated -p options. In the example above, we have given three data-points 0,0 (where x-axis and y-axis intesect) , 20,0 (a point on x-axis) and 0,1 (a point on y-axis).

We are going to click on the image to locate these coordinates later. Make sure to click in the same order.

  1. The data-points will be dumped to a csv file. If --plot option is given from command line, it will also plot the computed data-points. This requires matplotlib.

Notice the errors near the boxes; since we have not trimmed them.

Passing the location of coordinates manually

IMP: Bottom left corner of the image is (0,0) in most plots. However, for opencv which we are using in this project, top-left is mapped to (0,0). This may cause subtle effects if you are not careful when passing values of location manually. See issue #1 for discussion. I got these values from program gimp.

./plotdigitizer.py -i ./figures/trimmed.png -p 0,0 -p 20,0 -p 0,1 \
    -l 22,295 -l 142,295 -l 22,215 --plot

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 by Ankit Rohatagi.

Development

If you enhance the script, feel free to send a PR.

plotdigitizer's People

Contributors

dilawar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.