Height-dependent filling color in 3D Data Plots
If nobody comes with a much cleverer solution, this might be a way to achieve what you're looking for. However, first your data have to be reshaped.
newtable = {{1, 2, 1}, {3, 1, 3}, {4, 3, 4}};
BarChart3D[newtable, ChartLayout -> "Grid",
ViewPoint -> {3.33, -8.26, 5.36}, ColorFunction -> "DarkRainbow",
Method -> {"Canvas" -> None}]
With some additional options:
BarChart3D[newtable, ChartLayout -> "Grid", ChartElementFunction -> "Cube",
ViewPoint -> {3.33, -8.26, 5.36}, ColorFunction -> "DarkRainbow",
Method -> {"Canvas" -> None}, BarSpacing -> {None, None}]
There is also ... DiscretePlot3D
With appropriate settings for the options ExtentSize
and ColorFunction
you get something similar to BarChart3D
:
Two examples:
Row[{
DiscretePlot3D[table[[i, j]], {i, 1, 4}, {j, 1, 4},
BoxRatios -> {1., 1., .7}, ExtentSize -> Scaled[.75],
ColorFunction -> (Hue[#3] &)],
DiscretePlot3D[table[[i, j]], {i, 1, 4}, {j, 1, 4},
BoxRatios -> {1., 1., .7}, ExtentSize -> Full,
ColorFunction -> "Rainbow",
ExtentElementFunction -> "ProfileCube"]
}]
You could use graphics primitives to construct your plot. For example
{min, max} = Through[{Min, Max}[Flatten[table]]];
Graphics3D[
MapIndexed[{ColorData["DarkRainbow"][Rescale[#1, {min, max}]],
Cuboid[Append[#2, 0], Append[#2 + {1, 1}, #1]]} &, table, {2}],
Lighting -> "Neutral", Axes -> True]
produces