Re: Digitizing plots with Mathematica (i.e. extracting data points
- To: mathgroup at smc.vnet.net
- Subject: [mg107685] Re: Digitizing plots with Mathematica (i.e. extracting data points
- From: "Kevin J. McCann" <Kevin.McCann at umbc.edu>
- Date: Mon, 22 Feb 2010 19:05:25 -0500 (EST)
- References: <hlte0v$s7c$1@smc.vnet.net>
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 Will DeBeest wrote: > 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/ >