I want to plot a 3d array as a voxel grid (i.e. adjacent cubes of equal size) with PGFPlotsX.
So far I got a simple solution using a 3d scatterplot with filled cubes of separate color, depending on the array value.
The challenge is to get the size right so that each cube is adjacent to its neighbors, as shown here:

Is there a way to define the mark size of 3d scatterplots in the same unit as the axes?

Below is an MWE. I have so far tried two ways to control the cube size:
(1) Controlling width and height of the figure and setting cube size in absolute units, and
(2) Manually adjusting the size.
Attempt (1) seems unsuitable because with different view direction on the 3D axis the scale of the figure changes slightly.
And with (2) I could get some nice looking results, but this approach doesnâ€™t scale.

Shifting by axis units is only possible for two-dimensional plots since the outer normal is well-defined here: it is the other available axis.

This seems to concern only line shifts, but as far as I understood this axis units are defined by leaving out any dimension in the size argument, which didnâ€™t work for my case in 3D either.

If you want total control over the cubes using axis coordinates, look up â€śpatch plotsâ€ť in the pgfplots manual. We have a rudimentary example in PGFPlotsX to get you started: