3
$\begingroup$

I would like to have a 3d rectangle chart looks like the following:

enter image description here

Later on, I will use different transparent color for each small 3d rectangle. It seems that the function RectangleChart3D can give some results, but it only gives one row and not all of them.

does anyone know how to achieve this?

$\endgroup$
3
  • 2
    $\begingroup$ RectangleChart3D is one of those fake 3D plots, so you won't be able to easily get multiple rows. Depending on your data, you could use DiscretePlot3D (only works for regular grids) $\endgroup$
    – Lukas Lang
    Oct 1, 2019 at 12:02
  • 2
    $\begingroup$ How about Histogram3D? $\endgroup$ Oct 1, 2019 at 14:02
  • 1
    $\begingroup$ Would it not be simpler and easier to just (scale and) plot individual polygons? $\endgroup$
    – Dominic
    Oct 1, 2019 at 16:55

1 Answer 1

4
$\begingroup$

You can use RectangleChart3D with the option ChartLayout -> "Grid":

SeedRandom[1]
data = RandomReal[10, {5, 5, 3}];

RectangleChart3D[data, 
   ChartLayout -> "Grid",
   ColorFunction -> "Rainbow", 
   ViewPoint -> {10, -10, 10}]

enter image description here

Add the option ChartBaseStyle -> Opacity[.7] to make the cuboids transparent:

enter image description here

To remove the polygon faces and the canvas:

RectangleChart3D[data, ChartLayout -> "Grid", 
  ColorFunction -> "Rainbow", ImageSize -> Large, 
  ViewPoint -> {10, -5, 10}, 
  FaceGrids -> None, 
  "Canvas" -> False, 
  PerformanceGoal -> "Speed"] /. {Directive[___], p_} :> { 
   p /. Polygon[a_,  VertexColors -> {c_, ___}] :>
    {Antialiasing -> True, EdgeForm[{Opacity[1], Thick, c}], FaceForm[], Polygon[a]}}

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.