2
$\begingroup$

I am trying to get the edges as Lines from an ArrayPlot to do further analysis on such as remove edges depending on location or change their visual properties based on its location. I was unable to recover the actual coordinates of the Cuboid with Normal or the method mentioned in my previous post on a similar though slightly less complex example with Points.

g = ArrayPlot3D[ConstantArray[1, {4, 4, 4}]]

I was able to dig into the expression and get some way toward the look I want but I'm not sure what the next steps in manipulating it are to get a list of Lines with the correct 3D coordinates.

gg = g[[1, 2, 1]]
Translate[{FaceForm[None], EdgeForm[Directive[GrayLevel[0.2]]], Cuboid[{0, 0, 0}]},
{{0, -4, -4}, {1, -4, -4}, {2, -4, -4}, {3, -4, -4}, {0, -3, -4}, {1, -3, -4}, {2, -3, -4}, {3, -3, -4}, {0, -2, -4}, {1, -2, -4}, {2, -2, -4}, {3, -2, -4}, {0, -1, -4}, {1, -1, -4}, {2, -1, -4}, {3, -1, -4}, {0, -4, -3}, {1, -4, -3}, {2, -4, -3}, {3, -4, -3}, {0, -3, -3}, {1, -3, -3}, {2, -3, -3}, {3, -3, -3}, {0, -2, -3}, {1, -2, -3}, {2, -2, -3}, {3, -2, -3}, {0, -1, -3}, {1, -1, -3}, {2, -1, -3}, {3, -1, -3}, {0, -4, -2}, {1, -4, -2}, {2, -4, -2}, {3, -4, -2}, {0, -3, -2}, {1, -3, -2}, {2, -3, -2}, {3, -3, -2}, {0, -2, -2}, {1, -2, -2}, {2, -2, -2}, {3, -2, -2}, {0, -1, -2}, {1, -1, -2}, {2, -1, -2}, {3, -1, -2}, {0, -4, -1}, {1, -4, -1}, {2, -4, -1}, {3, -4, -1}, {0, -3, -1}, {1, -3, -1}, {2, -3, -1}, {3, -3, -1}, {0, -2, -1}, {1, -2, -1}, {2, -2, -1}, {3, -2, -1}, {0, -1, -1}, {1, -1, -1}, {2, -1, -1}, {3, -1, -1}}
]
Graphics3D@gg
$\endgroup$
2
$\begingroup$

You can extract lines (and other graphics primitives, like points for vertices, and polygons for faces) using MeshPrimitives.
ArrayPlot3D seems to use a convoluted specification consisting of translating a single Cuboid around, but in any case the following seems to work:

ArrayPlot3D[ConstantArray[1, {4, 4, 4}]] /. 
 Cuboid[a_] :> MeshPrimitives[Cuboid[a], 1]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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