1
$\begingroup$

I am trying to build a 3D rectangular bar plot similar to the attached image using the data table provided where each table entry is of the format (Xi,Yi,Zi) where (Xi,Yi) is the center of the the ith bar and Zi is the height. All bars should have the same size base (length*width). I have tried using Histogram3D,ListPlot3D, DiscretePlot3D but can't figure it out. Please help. Thanks!

data={{1/8, 1/8, 63/64}, {1/8, 3/8, 59/64}, {1/8, 5/8, 51/64}, {1/8, 7/8, 
  39/64}, {3/8, 1/8, 59/64}, {3/8, 3/8, 55/64}, {3/8, 5/8, 47/64}, {3/
  8, 7/8, 35/64}, {5/8, 1/8, 51/64}, {5/8, 3/8, 47/64}, {5/8, 5/8, 39/
  64}, {5/8, 7/8, 27/64}, {7/8, 1/8, 39/64}, {7/8, 3/8, 35/64}, {7/8, 
  5/8, 27/64}, {7/8, 7/8, 15/64}}

sample

$\endgroup$
3

1 Answer 1

1
$\begingroup$

There is no single command for this, but you can easily create this using "Graphics3D" and "Cuboid":

data = {{1/8, 1/8, 63/64}, {1/8, 3/8, 59/64}, {1/8, 5/8, 51/64}, {1/8,
     7/8, 39/64}, {3/8, 1/8, 59/64}, {3/8, 3/8, 55/64}, {3/8, 5/8, 
    47/64}, {3/8, 7/8, 35/64}, {5/8, 1/8, 51/64}, {5/8, 3/8, 
    47/64}, {5/8, 5/8, 39/64}, {5/8, 7/8, 27/64}, {7/8, 1/8, 
    39/64}, {7/8, 3/8, 35/64}, {7/8, 5/8, 27/64}, {7/8, 7/8, 15/64}};
Graphics3D [
 Cuboid[{#[[1]] - 1/8, #[[2]] - 1/8, 
     0}, {#[[1]] + 1/8, #[[2]] + 1/8, #[[3]]}] & /@ data ]

enter image description here

$\endgroup$

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