Digitize Your Graphs With WebPlotDigitizer

Have you ever had to write a bit of code to interpret a non-linear analog reading as picked up by an ADC? When all you have to work with for your transfer function is a graph in a semiconductor datasheet that was probably written thirty years ago and prints out the size of a postage stamp, that’s a rather annoying task. Wouldn’t it be nice if you had access to the numbers behind the graph!

You can’t knock on the office door of the engineer who created it back in the ’80s, he’s probably  in retirement and playing golf or growing prize petunias by now. But you can digitize the graph to get yourself a lot closer to the action, and to help you in your quest there’s a handy online tool.

2N3904 current gain

WebPlotDigitizer is not new, it’s been around for quite a few years now. But it’s still worth talking about, because it’s one of those tools to keep in reserve. If you’ve ever needed it, you’ll know what we mean.

So how does it work? Load an image with a graph in it, select some points on the X and Y axis, roughly trace the curve with a marker tool, and set it in motion. Let’s give it a go. We’re going to try digitizing the current gain plot from the 2N3904 datasheet (PDF) that we examined a few days ago.

Data points!

So, open the WebPlotDigitizer app, load the graph image captured from the sheet as a JPEG. It asks what type of graph you’ve loaded, in this case a 2D X-Y plot. It asks you to identify four known points on the axes and supply their values. You also tell it if the axes are logarithmic at this point. Select “Automatic mode” on the right hand side, then click “Pen” and mark the graph trace, then select the colour of the trace. Click the “Run” button, and your data points appear. Hit the “View data” button, and there you have it. A few rogue points to remove perhaps, but it does a pretty good job.

If WebPlotDigitizer has engaged your interest, you’ll be pleased to know that it’s open-source, and you can find all its code on GitHub. There is also a handy video tutorial which you can see below the break.

Looking through the Hackaday archives, we’ve covered this subject a couple of times before. Engauge is another graph digitizer, and we’ve also covered a photographic digitizer for servo splines.

A tip of the hat to [JD].

11 thoughts on “Digitize Your Graphs With WebPlotDigitizer

  1. Article contains link to older article that contains old comment with link to subject of current article. It is a spiral of madness I tell you! mahahahahahaaaaaaaaaa…. .

  2. Looks nice. It’d be even better if it went to the next step of analysing the points to work out the equation. That’d have the added advantage of helping eliminate those “rogue points”.

    1. You’d need to know a little bit a priori about the curve, but yes that should be doable. At least a polynomial curve quadratic fit.

      I use webplotdigitizer a lot and do that mostly afterwards in Python, because in most cases I have to compare it with data I created myself or need an interpolation.

    1. Download it as *.csv, fire up a ipython Notebook (within Anaconda Python https://www.continuum.io/downloads ) or create a python script. Guess a function which fits your needs:
      * Decaying function add: exp(x * a)
      * Oscillating function add: sin(x * b + c)*cos(x * b + c)
      * Offset add a constant term
      * Or a polynomial: a + x * b + x^2 * c + …

      Code Example with data from Weblotdigitizer:


  3. I never understood why component makers don’t make use of a PDFs full functionality…
    All those formulas could be interactive – just insert your application’s numbers and have the PDF spit out the required Rsense, number of coil-windings or whatever.

  4. “Have you ever had to write a bit of code to interpret a non-linear analog reading as picked up by an ADC?”

    The local vicar asked me that very question this morning over tea and muffins.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.