I might have made a mistake here. Suppose I have spent a long time doing a calculation for an array plot as follows:

  abc[15, 1, K, n], {K, 1, 400}, {n, 1, 400}]]

Where abc is just some function that takes a while to evaluate for large K and n. Now, once the computation finished, all of the information is there, visually. But suppose I want to keep all of the data (actual numerical values) in some kind of external file. Is there any way to do this after the fact? Or is the only way to get those numbers to go back, re-compute every value again in a table, and then export that table to a .hdf file?

  • $\begingroup$ why not assign it to a variable and use Export? It is even in your tags $\endgroup$
    – vapor
    Dec 1, 2017 at 7:44

1 Answer 1


If you have the result of the ArrayPlot in a notebook, then you can recover the data.

The result will typically be of the form

Graphics[Raster[data, ...], ...]

See The Structure of Graphics and related tutorials.

Assign the plot to a variable ap and try data = ap[[1,1]]. You may need to adjust this as in principle the structure of thr graphics could be slightly different, e.g. Graphics[{Raster[data,...]}, ...], which would require ap[[1,1,1]].

Also, the elements of data may be RGB triplets instead of single numbers. You may need to figure out the original data<->colour relationship.

  • $\begingroup$ Thanks, 'data = ap[[1,1]]' worked pretty well! $\endgroup$ Dec 1, 2017 at 21:12

Your Answer

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

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