1

I am following this post Parameters required by bar3d with python to understand the parameters of bar3d. The graph tallies with the data, but the plotting is not exact. I was expecting 0,0 to be exactly on 0,0. Also, dx = 0.1 and dy = 0.1 should have shown a square like impression, but is not.

Below is the data

   - { x: -3.6,   y: -0.019,   occurence: 676 }
   - { x: -3.10,  y: -0.0999,  occurence: 676 }
   - { x: -1.9,   y: -0.0999,  occurence: 676 }
   - { x: -0.07,  y: 0.,       occurence: 676 }
   - { x: 0.,     y: 0.,       occurence: 25564 }
   - { x: 5.941,  y: 0.0199,   occurence: 24644 }
   - { x: 5.942,  y: 0.0199,   occurence: 49288 }
   - { x: 5.96,   y: 0.0199,   occurence: 24723 }

enter image description here)

The corresponding code is

dx = np.empty(np.size(x))
dx.fill(0.1)
dy = np.empty(np.size(x)
dy.fill(0.1)

z = np.zeros(np.size(x_gt))

ax1.bar3d(x, y, z, dx, dy, occurence, "red" ) # z is dummy. occurence is height
infoclogged
  • 3,641
  • 5
  • 32
  • 53
  • The bars are square in data coordinates, not in display coordinates, where they have a 3:1 aspect due to the three times larger x range. Also the edge of the bar *is* exactly at (0,0). It may look differently because there is some margin on the zaxis. – ImportanceOfBeingErnest Apr 23 '18 at 17:37
  • awesome ! its so clear now... By the way, do you know, how can i remove the margin? Be free to post as an answer. – infoclogged Apr 23 '18 at 17:41
  • I don't know from the top of my head, but there are for sure already questions about this here on SO. Not sure if they have a satisfying answer. – ImportanceOfBeingErnest Apr 23 '18 at 17:44

0 Answers0