# Help me convert this graph into a table.

June 28, 2013 2:15 PM Subscribe

I have a bitmap of a chart (in polar coordinates) that I would like to convert into a format that some plotting package can recognize, and then retrieve values from the chart at specific intervals. How do I do this?

I have a polar chart here, the link to which contains a description of how to use the chart, as well as the only chart I actually have.

What I would like to do is be able to trace the curves as they appear on the chart using a bezier-curve drawing tool, and then I'd like to be able to output the following table:

The x-axis would be "wind speed" and have one entry for each line on the chart (5, 8, 10, 14, and 20 knots).

The y-axis would be "angle", from 0-180 in five degree increments.

The value in each box in the table would be "boat speed" which is the radius of the curve for the corresponding "wind speed" line as it appears at the given angle.

Eventually, this will end up in the file format specified here, but first I am just interested in getting this into a plotting program that will let me enter these arbitrary curves (hopefully by placing my existing chart as an image and then tracing over it) into a polar coordinates space such that I can simply read r,θ pairs off the screen for the point under my mouse.

I would like to be able to automatically generate r values at five degree increments along each of my lines, but I'll type the numbers in by hand if I need to.

I am using a mac and would like to use the least expensive software that's capable of doing this, but I'm willing to buy some plotting package if it's reasonably priced. I have excel and I'm a programmer, so if I need to script some other package to generate output, I can probably do that, too.

I have a polar chart here, the link to which contains a description of how to use the chart, as well as the only chart I actually have.

What I would like to do is be able to trace the curves as they appear on the chart using a bezier-curve drawing tool, and then I'd like to be able to output the following table:

The x-axis would be "wind speed" and have one entry for each line on the chart (5, 8, 10, 14, and 20 knots).

The y-axis would be "angle", from 0-180 in five degree increments.

The value in each box in the table would be "boat speed" which is the radius of the curve for the corresponding "wind speed" line as it appears at the given angle.

Eventually, this will end up in the file format specified here, but first I am just interested in getting this into a plotting program that will let me enter these arbitrary curves (hopefully by placing my existing chart as an image and then tracing over it) into a polar coordinates space such that I can simply read r,θ pairs off the screen for the point under my mouse.

I would like to be able to automatically generate r values at five degree increments along each of my lines, but I'll type the numbers in by hand if I need to.

I am using a mac and would like to use the least expensive software that's capable of doing this, but I'm willing to buy some plotting package if it's reasonably priced. I have excel and I'm a programmer, so if I need to script some other package to generate output, I can probably do that, too.

One trick is that you would need to ensure the curves are aligned to the polar plot, in order to get correct values. One easy to way to do this is to have d3 render a polar plot that matches the original figure as closely as possible (i.e., render half of the NE quadrant and all of the SE quadrant, if that makes sense).

posted by Blazecock Pileon at 2:49 PM on June 28, 2013

posted by Blazecock Pileon at 2:49 PM on June 28, 2013

Somebody good with ImageMagick could make quick work of this. Adjust the image to black 0 and white 1 only. Bring it down to 50% grey .5 and white 1 only. Draw 50% .5 subtractive lines every 5° from the boat point to the edge. This will leave the points where the 5° lines cross the data lines being black 1. Then clean up around the boat origin area and dump the x,y of the points in the image that are black 1. Then you can use trig to get the angle and distance to the boat origin and the closest will be the 5Knt point and the farthest will be the 20Knt point. Do the 5° lines one at a time from the 50% image and you'll get 5 points at a time. You'd have to avoid the actual 60,90,120° lines and the 2,4,6,8 radius lines (or remove them from the original.

Maybe even easier to clean the image of the grid type lines and just dump the x,y of all the non-white points left. Do that for 4 images that each only has one of the curves and you can do the trig and just pick the points closest to the 5° points.

posted by zengargoyle at 6:10 PM on June 28, 2013

Maybe even easier to clean the image of the grid type lines and just dump the x,y of all the non-white points left. Do that for 4 images that each only has one of the curves and you can do the trig and just pick the points closest to the 5° points.

posted by zengargoyle at 6:10 PM on June 28, 2013

Best answer: WebPlotDigitizer digitizes charts — including polar — in your browser.

F'rinstance, I took your sample page, pasted the image into the web app. clicked three points to define the origin and scale, then did some rough clicking on the upper inner trace, and got:

If you like standalone programs, I have heard good things of Engauge Digitizer.

Personally, I'd smack the results through

posted by scruss at 6:59 PM on June 28, 2013 [2 favorites]

F'rinstance, I took your sample page, pasted the image into the web app. clicked three points to define the origin and scale, then did some rough clicking on the upper inner trace, and got:

4.226195010134977,73.82302251889313 4.632937078115445,68.67317404787977 5.010779446226897,61.711942060613026 5.303268757374677,54.99220163583076 5.479574214480536,48.523024910298886 5.502614784871417,44.61037769121114 5.578542026651272,37.28351494200738 5.4577936678660235,32.11127675050665That many decimal places isn't strictly necessary, but the data's easily extracted.

If you like standalone programs, I have heard good things of Engauge Digitizer.

**digitizer**is the keyword you're looking for.Personally, I'd smack the results through

`spline`then try to fit a function to it. If it's a function of wind force, it'll likely be a parabolic against speed. The results plotted on a Cartesian graph make things much clearer.posted by scruss at 6:59 PM on June 28, 2013 [2 favorites]

I'll mention a couple of other digitizers, but they don't directly solve your curve-fitting problem. I like GraphClick for digitizing graph data, and it's inexpensive, but it doesn't seem to do polar. You could digitize x,y and then translate, I suppose. DataThief, which I've never tried, looks like it does do polar.

posted by spbmp at 9:38 PM on June 28, 2013

posted by spbmp at 9:38 PM on June 28, 2013

Response by poster: Webplot digitizer is almost perfect for this, it does a great job of auto-tracing the lines. But it gives me nonsensical angles in the output. So I tried enguage and that doesn't trace very well at all, but at least gives me accurate output, so I've been using it to get each point individually and then entering those by hand, which is monotonous but better than nothing.

posted by tylerkaraszewski at 11:02 AM on June 30, 2013

posted by tylerkaraszewski at 11:02 AM on June 30, 2013

Did you set angles clockise in WPD? Standard mathematical convention is anticlockwise from east, while the compass is clockwise from north. You can convert between the two in Excel with

posted by scruss at 7:06 PM on June 30, 2013

`=MOD(450-angle, 360)`.posted by scruss at 7:06 PM on June 30, 2013

This thread is closed to new comments.

svg:imageobject.This image object would be a transparent PNG containing your polar chart, minus the axes (i.e. just those pixels showing the curves you're interested in). You'd use Photoshop to erase the polar axes and labels, for instance.

Once you overlap the curves on top of the d3-rendered polar chart, you could use d3 to add

clickandmouseoverevent handlers that report back the radius and theta values as you "trace" the mouse pointer over the curves-of-interest.These values could either be reported to the screen and you write them down. Or, probably better, you would store them as a series of JavaScript Array instances into a parent JavaScript Object, one series for each traced curve.

Once you're done tracing, the values could be written from local browser storage to a file using HTML5 FileSystem routines, as a comma-separated-value file or any other format you'd like.

posted by Blazecock Pileon at 2:43 PM on June 28, 2013