1
$\begingroup$

The following array has non-zero entries in the cells where all three indices are equal:

foo = SparseArray[{i_, i_, i_} -> 1, {4, 4, 4}]

When I try to render this in ArrayMesh, though, the resulting graphic has the third axis reversed:

ArrayMesh[foo, PlotTheme -> "Scientific", AxesLabel -> {i, j, k}]

enter image description here

The filled cells should be on the diagonal going from the lower left to the upper right.

Using the DataReversed -> True option appears to reverse the first axis only (or equivalently, the second and third axes while leaving the first axis the same):

ArrayMesh[foo, PlotTheme -> "Scientific", DataReversed -> True, AxesLabel -> {i, j, k}]

enter image description here

Trying to set an option such as DataReversed -> {True, False} or DataReversed -> {True, False, True} results in a graph identical to the first graph.

Is there a way to get Mathematica to render all three axes in the correct order? I am using MM 12.0.0 on a Mac, in case this is version-dependent.

$\endgroup$
1
  • $\begingroup$ Please send a report to Support. $\endgroup$ – J. M.'s ennui Sep 11 '20 at 16:07
1
$\begingroup$

Indeed an annoyance. Apparently, vector-valued settings for DataReversed are just ignored. Something for support, I guess.

Does

ArrayMesh[Map[Reverse, foo, 1], PlotTheme -> "Scientific", AxesLabel -> {i, j, k}]

do what you want?

$\endgroup$
1
  • 1
    $\begingroup$ I would use Reverse[foo, 2] instead of Map[Reverse, foo, 1] myself. $\endgroup$ – J. M.'s ennui Sep 11 '20 at 16:08

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.