@@ -4715,7 +4715,31 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
4715
4715
the hexagons are approximately regular.
4716
4716
4717
4717
Alternatively, if a tuple (*nx*, *ny*), the number of hexagons
4718
- in the *x*-direction and the *y*-direction.
4718
+ in the *x*-direction and the *y*-direction. In the
4719
+ *y*-direction, counting is done along vertically aligned
4720
+ hexagons, not along the zig-zag chains of hexagons; see the
4721
+ following illustration.
4722
+
4723
+ .. plot::
4724
+
4725
+ import numpy
4726
+ import matplotlib.pyplot as plt
4727
+
4728
+ np.random.seed(19680801)
4729
+ n= 300
4730
+ x = np.random.standard_normal(n)
4731
+ y = np.random.standard_normal(n)
4732
+
4733
+ fig, ax = plt.subplots(figsize=(4, 4))
4734
+ h = ax.hexbin(x, y, gridsize=(5, 3))
4735
+ hx, hy = h.get_offsets().T
4736
+ ax.plot(hx[24::3], hy[24::3], 'ro-')
4737
+ ax.plot(hx[-3:], hy[-3:], 'ro-')
4738
+ ax.set_title('gridsize=(5, 3)')
4739
+ ax.axis('off')
4740
+
4741
+ To get approximately regular hexagons, choose
4742
+ :math:`n_x = \\ sqrt{3}\\ ,n_y`.
4719
4743
4720
4744
bins : 'log' or int or sequence, default: None
4721
4745
Discretization of the hexagon values.
0 commit comments