@@ -4681,7 +4681,31 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
4681
4681
the hexagons are approximately regular.
4682
4682
4683
4683
Alternatively, if a tuple (*nx*, *ny*), the number of hexagons
4684
- in the *x*-direction and the *y*-direction.
4684
+ in the *x*-direction and the *y*-direction. In the
4685
+ *y*-direction, counting is done along vertically aligned
4686
+ hexagons, not along the zig-zag chains of hexagons; see the
4687
+ following illustration.
4688
+
4689
+ .. plot::
4690
+
4691
+ import numpy
4692
+ import matplotlib.pyplot as plt
4693
+
4694
+ np.random.seed(19680801)
4695
+ n= 300
4696
+ x = np.random.standard_normal(n)
4697
+ y = np.random.standard_normal(n)
4698
+
4699
+ fig, ax = plt.subplots(figsize=(4, 4))
4700
+ h = ax.hexbin(x, y, gridsize=(5, 3))
4701
+ hx, hy = h.get_offsets().T
4702
+ ax.plot(hx[24::3], hy[24::3], 'ro-')
4703
+ ax.plot(hx[-3:], hy[-3:], 'ro-')
4704
+ ax.set_title('gridsize=(5, 3)')
4705
+ ax.axis('off')
4706
+
4707
+ To get approximately regular hexagons, choose
4708
+ :math:`n_x = \\ sqrt{3}\\ ,n_y`.
4685
4709
4686
4710
bins : 'log' or int or sequence, default: None
4687
4711
Discretization of the hexagon values.
0 commit comments