@@ -4537,63 +4537,60 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
45374537 reduce_C_function = np .mean , mincnt = None , marginals = False ,
45384538 ** kwargs ):
45394539 """
4540- Make a hexagonal binning plot.
4540+ Make a 2D hexagonal binning plot of points *x*, *y* .
45414541
4542- Make a hexagonal binning plot of *x* versus *y*, where *x*,
4543- *y* are 1-D sequences of the same length, *N*. If *C* is *None*
4544- (the default), this is a histogram of the number of occurrences
4545- of the observations at (x[i],y[i]).
4546-
4547- If *C* is specified, it specifies values at the coordinate
4548- (x[i], y[i]). These values are accumulated for each hexagonal
4549- bin and then reduced according to *reduce_C_function*, which
4550- defaults to `numpy.mean`. (If *C* is specified, it must also
4551- be a 1-D sequence of the same length as *x* and *y*.)
4542+ If *C* is *None*, the value of the hexagon is determined by the number
4543+ of points in the hexagon. Otherwise, *C* specifies values at the
4544+ coordinate (x[i], y[i]). For each hexagon, these values are reduced
4545+ using *reduce_C_function*.
45524546
45534547 Parameters
45544548 ----------
4555- x, y : array or masked array
4556-
4557- C : array or masked array, optional, default is *None*
4549+ x, y : array-like
4550+ The data positions. *x* and *y* must be of the same length.
45584551
4559- gridsize : int or (int, int), optional, default is 100
4560- The number of hexagons in the *x*-direction, default is
4561- 100. The corresponding number of hexagons in the
4562- *y*-direction is chosen such that the hexagons are
4563- approximately regular. Alternatively, gridsize can be a
4564- tuple with two elements specifying the number of hexagons
4565- in the *x*-direction and the *y*-direction.
4552+ C : array-like, optional
4553+ If given, these values are accumulated in the bins. Otherwise,
4554+ every point has a value of 1. Must be of the same length as *x*
4555+ and *y*.
45664556
4567- bins : 'log' or int or sequence, optional, default is *None*
4568- If *None*, no binning is applied; the color of each hexagon
4569- directly corresponds to its count value.
4557+ gridsize : int or (int, int), default: 100
4558+ If a single int, the number of hexagons in the *x*-direction.
4559+ The number of hexagons in the *y*-direction is chosen such that
4560+ the hexagons are approximately regular.
45704561
4571- If 'log', use a logarithmic scale for the color
4572- map. Internally, :math:`log_{10}(i+1)` is used to
4573- determine the hexagon color.
4562+ Alternatively, if a tuple (*nx*, *ny*), the number of hexagons
4563+ in the *x*-direction and the *y*-direction.
45744564
4575- If an integer, divide the counts in the specified number
4576- of bins, and color the hexagons accordingly .
4565+ bins : 'log' or int or sequence, default: *None*
4566+ Discretization of the hexagon values .
45774567
4578- If a sequence of values, the values of the lower bound of
4579- the bins to be used.
4568+ - If *None*, no binning is applied; the color of each hexagon
4569+ directly corresponds to its count value.
4570+ - If 'log', use a logarithmic scale for the color map.
4571+ Internally, :math:`log_{10}(i+1)` is used to determine the
4572+ hexagon color. This is equivalent to ``norm=LogNorm()``.
4573+ - If an integer, divide the counts in the specified number
4574+ of bins, and color the hexagons accordingly.
4575+ - If a sequence of values, the values of the lower bound of
4576+ the bins to be used.
45804577
4581- xscale : {'linear', 'log'}, optional, default is 'linear'
4578+ xscale : {'linear', 'log'}, default: 'linear'
45824579 Use a linear or log10 scale on the horizontal axis.
45834580
4584- yscale : {'linear', 'log'}, optional, default is 'linear'
4581+ yscale : {'linear', 'log'}, default: 'linear'
45854582 Use a linear or log10 scale on the vertical axis.
45864583
4587- mincnt : int > 0, optional, default is *None*
4584+ mincnt : int > 0, default: *None*
45884585 If not *None*, only display cells with more than *mincnt*
4589- number of points in the cell
4586+ number of points in the cell.
45904587
4591- marginals : bool, optional, default is *False*
4592- if marginals is *True*, plot the marginal density as
4588+ marginals : bool, default: *False*
4589+ If marginals is *True*, plot the marginal density as
45934590 colormapped rectangles along the bottom of the x-axis and
4594- left of the y-axis
4591+ left of the y-axis.
45954592
4596- extent : scalar, optional, default is *None*
4593+ extent : float, default: *None*
45974594 The limits of the bins. The default assigns the limits
45984595 based on *gridsize*, *x*, *y*, *xscale* and *yscale*.
45994596
@@ -4606,55 +4603,67 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
46064603
46074604 Other Parameters
46084605 ----------------
4609- cmap : object, optional, default is *None*
4610- a :class:`matplotlib.colors. Colormap` instance. If *None*,
4611- defaults to rc `` image.cmap` `.
4606+ cmap : str or `~matplotlib.colors.Colormap`, optional
4607+ The Colormap instance or registered colormap name used to map
4608+ the bin values to colors. Defaults to :rc:` image.cmap`.
46124609
4613- norm : object, optional, default is *None*
4614- :class:`matplotlib.colors.Normalize` instance is used to
4615- scale luminance data to 0,1.
4610+ norm : `~matplotlib.colors.Normalize`, optional
4611+ The Normalize instance scales the bin values to the canonical
4612+ colormap range [0, 1] for mapping to colors. By default, the data
4613+ range is mapped to the colorbar range using linear scaling.
46164614
4617- vmin, vmax : scalar , optional, default is * None*
4618- *vmin* and *vmax* are used in conjunction with *norm* to
4619- normalize luminance data. If *None*, the min and max of the
4620- color array *C* are used. Note if you pass a norm instance
4621- your settings for *vmin* and *vmax* will be ignored .
4615+ vmin, vmax : float , optional, default: None
4616+ The colorbar range. If *None*, suitable min/max values are
4617+ automatically chosen by the `~.Normalize` instance (defaults to
4618+ the respective min/max values of the bins in case of the default
4619+ linear scaling). This is ignored if *norm* is given .
46224620
4623- alpha : scalar between 0 and 1, optional, default is *None*
4624- the alpha value for the patches
4621+ alpha : float between 0 and 1, optional
4622+ The alpha blending value, between 0 (transparent) and 1 (opaque).
46254623
4626- linewidths : scalar, optional, default is *None*
4624+ linewidths : float, default: *None*
46274625 If *None*, defaults to 1.0.
46284626
4629- edgecolors : {'face', 'none', *None*} or color, optional
4627+ edgecolors : {'face', 'none', *None*} or color, default: 'face'
4628+ The color of the hexagon edges. Possible values are:
4629+
4630+ - 'face': Draw the edges in the same color as the fill color.
4631+ - 'none': No edges are drawn. This can sometimes lead to unsightly
4632+ unpainted pixels between the hexagons.
4633+ - *None*: Draw outlines in the default color.
4634+ - An explicit matplotlib color.
46304635
4631- If 'face' (the default), draws the edges in the same color as the
4632- fill color.
4636+ reduce_C_function : callable, default is `numpy.mean`
4637+ The function to aggregate *C* within the bins. It is ignored if
4638+ *C* is not given. This must have the signature::
46334639
4634- If 'none', no edge is drawn; this can sometimes lead to unsightly
4635- unpainted pixels between the hexagons.
4640+ def reduce_C_function(C: array) -> float
46364641
4637- If *None*, draws outlines in the default color.
4642+ Commonly used functions are:
46384643
4639- If a matplotlib color arg, draws outlines in the specified color.
4644+ - `numpy.mean`: average of the points
4645+ - `numpy.sum`: integral of the point values
4646+ - `numpy.max`: value taken from the largest point
4647+
4648+ **kwargs : `~matplotlib.collections.PolyCollection` properties
4649+ All other keyword arguments are passed on to `.PolyCollection`:
4650+
4651+ %(PolyCollection)s
46404652
46414653 Returns
46424654 -------
4643- polycollection
4644- A `.PolyCollection` instance; use `.PolyCollection.get_array` on
4645- this to get the counts in each hexagon.
4655+ polycollection : `~matplotlib.collections.PolyCollection`
4656+ A `.PolyCollection` defining the hexagonal bins.
4657+
4658+ - `.PolyCollection.get_offset` contains a Mx2 array containing
4659+ the x, y positions of the M hexagon centers.
4660+ - `.PolyCollection.get_array` contains the values of the M
4661+ hexagons.
46464662
46474663 If *marginals* is *True*, horizontal
46484664 bar and vertical bar (both PolyCollections) will be attached
46494665 to the return collection as attributes *hbar* and *vbar*.
46504666
4651- Notes
4652- -----
4653- The standard descriptions of all the
4654- :class:`~matplotlib.collections.Collection` parameters:
4655-
4656- %(Collection)s
4657-
46584667 """
46594668 self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
46604669
0 commit comments