There have been times when I want to find the structure of an object in order to extract some part of it. For example, extracting the x and y coordinates from a Graphics object generated by Plot. I start by using FullForm or InputForm, which works well if the object is small. If it's large I get its Dimensions and evaluate object[[1]], object[[2]], object[[2,1]], object[[2,2]], object[[2,2,1]], object[[2,2,2]] and so on until I find what I want. For the example above I eventually find that g[[1, 1, 3, 2, 1]] is the list of points.
I would like to automate this using Manipulate. So far I have tried:
InspectObject[o_] := Module[ {d = Dimensions[o], iter}, iter = MapIndexed[{Subscript[i, First[#2]], 1, #1, 1} &, d]; Manipulate[ o[[##]] & @@ Thread[Subscript[i, Range[Length[d]]]], ##] & @@ iter ] which is supposed to create a slider that varies from 1 to d[[k]] for each dimension of the object. But the Manipulate indices are not being evaluated properly.
g=Plot[Sin[x], {x, -3, 3}]; InspectObject[g] should be equivalent to:
Manipulate[g[[i]], {i, 1, 2, 1}] It would be even cooler if I could inspect each part recursively and interactively specify a range for each level.
![screenshot showing <code>Inspect[g]</code>](https://i.sstatic.net/MW3Yc.png)







