ArrayPlot3D : want to represent the values in the heights of rectangular blocks

I would like to achieve something like ArrayPlot[] but rather than using the array values for color, I want those values to specify heights of rectangular blocks. There seems to be no option in ArrayPlot to do that. Is there some good ideas to do that in ArrayPlot or in other commands? Thank you in advance.

• You could use something like BarChart3D[{{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1, 4}}, ChartLayout -> "Grid"]. Commented Jun 14, 2016 at 15:15

Here's a way to roll your own:

(*Some sample data.*)
data = Table[Exp[-(x^2/1 + y^2/2)], {x, -2, 2, 0.1}, {y, -2, 2, 0.1}];

(*Use colored cuboids with data as the heights.*)
rectPlot[data_] := Module[
{dimx, dimy},
{dimx, dimy} = Dimensions@data;
Graphics3D[
Table[
{
Hue[data[[i, j]]/Max@data],
Cuboid[{i, j, 0}, {i + 1, j + 1, data[[i, j]]}]
}
, {i, dimx}
, {j, dimy}
]
, BoxRatios -> {1, 1, 1}
]
]

rectPlot[data]


Which gives:

You can investigate the options for Graphics3D if this is too basic, but it's a start.

Another option is to use ListPlot3D:

ListPlot3D[
data
, InterpolationOrder -> 0
, Filling -> Axis
, ColorFunction->Hue
, FillingStyle -> Opacity[1]
, BoxRatios -> {1, 1, 1}
]


But I don't know how to color the filling on this plot.

• Here's an alternative implementation: Graphics3D[Transpose[{Map[ColorData["TemperatureMap"], Rescale[data], {2}], MapIndexed[Cuboid[Append[#2, 0], Append[#2 + 1, #1]] &, data, {2}]}, {3, 1, 2}], BoxRatios -> {1, 1, 0.4}, Lighting -> "Classic"] Commented Jun 14, 2016 at 16:56