Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Digitizing plots with Mathematica (i.e. extracting data points from

169 views
Skip to first unread message

Will DeBeest

unread,
Feb 22, 2010, 3:07:59 AM2/22/10
to
I've just written a blog post showing how to make a plot digitizer
using Mathematica. It may be of interest to other Mathematica users
particularly anyone who wants to extract some data out of plots.

barChartDigitizer[g_Image] :=
DynamicModule[{min = {0, 0}, max = {0, 0}, xmin = -1., xmax = 1.,
pt = {0, 0}, data = {}, img = ImageDimensions[g], output},

Deploy@Column[{
Row[{
Column[{Button["Y Axis Min", min = pt],
InputField[Dynamic[xmin], Number, ImageSize -> 70]}],
Column[{Button["Y Axis Max", max = pt],
InputField[Dynamic[xmax], Number, ImageSize -> 70]}],
Column[{Button["Add point", AppendTo[data, pt]],
Button["Remove Last", data = Quiet@Check[Most@data, {}]]}],
Column[{Button["Start Over", data = {}],
Button["Print Output",
Print@Column[{BarChart[
output =
Rescale[#, {Last@min, Last@max}, {xmin, xmax}] & /@
data[[All, 2]],
PlotRange -> {Automatic, {xmin, xmax}},
ImageSize -> 400], output}],
Enabled -> Dynamic[data =!= {}]]}]
}],
Row[{
Graphics[{Inset[
Image[g, ImageSize -> img]], {Tooltip[Locator[Dynamic[pt]],
Dynamic[pt]]}},
ImageSize -> img, PlotRange -> 1,
AspectRatio -> img[[2]]/img[[1]]]}]
}]
]

A full description will a worked example can be found here:

http://www.wildebeests.net/2010/02/21/digitizing-plots-with-mathematica/

Kevin J. McCann

unread,
Feb 22, 2010, 7:05:13 PM2/22/10
to
You should probably also consider the possibility that your image is not
exactly horizontal/vertical. This will likely be the case if you scan an
image from a book or journal.

Kcvin

0 new messages