I have some plots in an old Mathematica notebook that I'd like to re-create in Matplotlib (for stylistic consistency with the rest of the plots in my thesis).

Unfortunately, I've lost the data that I used to generate these plots. Since the plots are still intact, is it possible to extract the coordinates of the data points from them? I know that I can use "Get Coordinates" from the context menu on the plot, but this is tedious and imprecise!

They were generated in version 8 or 9, I think. This is the code that I used to generate the plots:

MoneyPlot[dataSets_, Vs_, fs_] := 
  Show @@ {ListLogLogPlot[dataSets[[1, 1]], 
      PlotStyle -> dataSets[[1, 2]],
      Joined -> True
      (* Some more options *)
    Table[ListLogLogPlot[data[[1]], PlotStyle -> data[[2]], 
      Joined -> True], {data, dataSets[[2 ;;]]}];

Example plot

  • $\begingroup$ Could you post an example plot? $\endgroup$ Sep 11, 2015 at 17:50
  • 2
    $\begingroup$ Were these plots made in MMA V6 or later? @DavidG.Stork's question is important, because we need to know what types of plots (Plot, ContourPlot, DensityPlot, etc.) these are, how many traces are shown on each plot, etc. So please post an example! $\endgroup$
    – march
    Sep 11, 2015 at 17:50
  • $\begingroup$ related mathematica.stackexchange.com/q/38257/2079 $\endgroup$
    – george2079
    Sep 11, 2015 at 19:01
  • $\begingroup$ Related, if not a duplicate. $\endgroup$
    – march
    Sep 11, 2015 at 19:06

2 Answers 2


As explained by anderstood, if you don't have the plots named, you need to copy and paste the figure into an input cell and type, say, fig = in front of the figure, then evaluate.

Suppose you generated a MoneyPlot named fig. Then, you can extract the data making up those curves using

data = Cases[fig // Normal, Line[a_] :> a, Infinity]

In order to test and see if it has extracted correctly, do

ListPlot[#] & /@ data

and you should see a List of Plots, one for each of the curves above.

For the purposes of illustration,

fig = Plot[{x^2, x^3, x^4}, {x, 0, 1}, Frame -> True, GridLines -> Automatic]
data = Cases[fig // Normal, Line[a_] :> a, Infinity];
ListPlot[#] & /@ %

results in

enter image description here

Since you have a LogLogPlot, if you want the actual values, rather than the values of the exponents, you just need to wrap data with Exp:

originalValues = Exp[data];

One more thing: this method requires that the points in your figure be Joined, as you've shown. If that is not the case, then you have to extract the Points instead. For instance,

fig = ListLogLogPlot[Table[{x, #}, {x, 0.01, 1, 0.01}] & /@ {x, x^2, x^3}, Frame -> True, GridLines -> Automatic]
data = Cases[fig // Normal, Point[a_] :> a, Infinity];
ListPlot[#] & /@ data

results in

enter image description here

  • $\begingroup$ I am not sure if he can name the figure fig as, if I understand correctly, he cannot run MoneyPlot since he lost the data. I guess he just has the image saved in a *.nb. The only solution I see is to copy and paste. $\endgroup$
    – anderstood
    Sep 11, 2015 at 18:18
  • $\begingroup$ @anderstood. Agreed. I will edit as necessary. $\endgroup$
    – march
    Sep 11, 2015 at 18:18
  • $\begingroup$ Thanks both – this has saved me! $\endgroup$ Sep 11, 2015 at 19:42
  • $\begingroup$ @Ruslan . I think those points were addressed in the second part of my post? $\endgroup$
    – march
    Jan 15, 2017 at 16:38
  • $\begingroup$ Oh indeed, hadn't read up to there :) $\endgroup$
    – Ruslan
    Jan 15, 2017 at 17:18
  • First step for illustration purpose : generate an image

MoneyPlot[{{{1, 2, 6}, {6, 3, 3}}}, 0, 0]

enter code here

  • Copy the plot and paste it instead of PASTE:


  • Get the points (in log-log) and take the exponential:

    Map[Exp, fig[[1, 2, 3, 4, 1]]]

Output: {{1., 1.}, {2., 2.}, {3., 6.}}

You might have to adjust the indexes in fig.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.