# Color scheme in BarChart3D

Hello fellow Mathematica users! I am trying to plot a barchart 3d plot for some data. However, I am facing issues with colorscheme. For example consider the following code:

dta = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

BarChart3D[dta, ChartLayout -> "Grid", ViewPoint -> {3.33, -8.26, 5.36}]


If you run the above simplistic code, you will see a 3*3 bar chart. However, in this plot, all the bars in the column have the same color. But I need same color bars in the row. Can you suggest a way such that I have same color bars in the row?

• Using Transpose :) : BarChart3D[Reverse /@ Transpose[dta], ChartLayout -> "Grid", ViewPoint -> {3.33, -8.26, 5.36}]. More seriously, 1) I cannot find documentation describing ChartLayout -> "Grid", and 2) using ColorFunction might be a possible way. Jun 12, 2023 at 13:43
• Thanks for the suggestion. @AntonAntonov, but this code still not generates plot with same color bars horizontally. Jun 12, 2023 at 13:50
• It does -- did you try it? Jun 12, 2023 at 13:58

BarChart3D[dta,
ChartLayout -> "Grid",
ViewPoint -> {3.33, -8.26, 5.36},
ChartStyle -> {Automatic, None}]


To remove the background panels use "Canvas" -> False :

BarChart3D[dta,
ChartLayout -> "Grid",
ViewPoint -> {3.33, -8.26, 5.36},
ChartStyle -> {Automatic, None},
"Canvas" -> False]


• Many thanks @kglr, it is very simple and useful. Jun 12, 2023 at 14:30
• @physicsgeek, my pleasure. Thank you for the accept.
– kglr
Jun 12, 2023 at 14:31

Here is a possible, not very good, solution via Reverse /@ Transpose[...]:

gr = BarChart3D[Reverse /@ Transpose[dta], Axes -> True,
FaceGrids -> {{-1, 0, 0}}, ChartLayout -> "Grid", Ticks -> All,
ViewPoint->
List[8.90170545374032, 3.8424205491683088, 3.741048561323293],
Boxed -> True]


The panels can be removed with Rest :

Rest /@ gr
`
• Thanks again. Yeah, it works. Jun 12, 2023 at 14:07
• No problem! But there should be a more streamlined and better looking solution. Jun 12, 2023 at 14:13