From: Kevin J. McCann on 22 Feb 2010 19:05 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(a)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(a)Check[Most(a)data, {}]]}], > Column[{Button["Start Over", data = {}], > Button["Print Output", > Print(a)Column[{BarChart[ > output = > Rescale[#, {Last(a)min, Last(a)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/ >
|
Pages: 1 Prev: Error List Plot with Legends Next: Exporting interactive 3D objects from Mathematica to PDF |