@@ -4496,63 +4496,60 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
44964496 reduce_C_function = np .mean , mincnt = None , marginals = False ,
44974497 ** kwargs ):
44984498 """
4499- Make a hexagonal binning plot.
4499+ Make a 2D hexagonal binning plot of points *x*, *y* .
45004500
4501- Make a hexagonal binning plot of *x* versus *y*, where *x*,
4502- *y* are 1-D sequences of the same length, *N*. If *C* is *None*
4503- (the default), this is a histogram of the number of occurrences
4504- of the observations at (x[i],y[i]).
4505-
4506- If *C* is specified, it specifies values at the coordinate
4507- (x[i], y[i]). These values are accumulated for each hexagonal
4508- bin and then reduced according to *reduce_C_function*, which
4509- defaults to `numpy.mean`. (If *C* is specified, it must also
4510- be a 1-D sequence of the same length as *x* and *y*.)
4501+ If *C* is *None*, the value of the hexagon is determined by the number
4502+ of points in the hexagon. Otherwise, *C* specifies values at the
4503+ coordinate (x[i], y[i]). For each hexagon, these values are reduced
4504+ using *reduce_C_function*.
45114505
45124506 Parameters
45134507 ----------
4514- x, y : array or masked array
4515-
4516- C : array or masked array, optional, default is *None*
4508+ x, y : array-like
4509+ The data positions. *x* and *y* must be of the same length.
45174510
4518- gridsize : int or (int, int), optional, default is 100
4519- The number of hexagons in the *x*-direction, default is
4520- 100. The corresponding number of hexagons in the
4521- *y*-direction is chosen such that the hexagons are
4522- approximately regular. Alternatively, gridsize can be a
4523- tuple with two elements specifying the number of hexagons
4524- in the *x*-direction and the *y*-direction.
4511+ C : array-like, optional
4512+ If given, these values are accumulated in the bins. Otherwise,
4513+ every point has a value of 1. Must be of the same length as *x*
4514+ and *y*.
45254515
4526- bins : 'log' or int or sequence, optional, default is *None*
4527- If *None*, no binning is applied; the color of each hexagon
4528- directly corresponds to its count value.
4516+ gridsize : int or (int, int), default: 100
4517+ If a single int, the number of hexagons in the *x*-direction.
4518+ The number of hexagons in the *y*-direction is chosen such that
4519+ the hexagons are approximately regular.
45294520
4530- If 'log', use a logarithmic scale for the color
4531- map. Internally, :math:`log_{10}(i+1)` is used to
4532- determine the hexagon color.
4521+ Alternatively, if a tuple (*nx*, *ny*), the number of hexagons
4522+ in the *x*-direction and the *y*-direction.
45334523
4534- If an integer, divide the counts in the specified number
4535- of bins, and color the hexagons accordingly .
4524+ bins : 'log' or int or sequence, default: *None*
4525+ Discretization of the hexagon values .
45364526
4537- If a sequence of values, the values of the lower bound of
4538- the bins to be used.
4527+ - If *None*, no binning is applied; the color of each hexagon
4528+ directly corresponds to its count value.
4529+ - If 'log', use a logarithmic scale for the color map.
4530+ Internally, :math:`log_{10}(i+1)` is used to determine the
4531+ hexagon color. This is equivalent to ``norm=LogNorm()``.
4532+ - If an integer, divide the counts in the specified number
4533+ of bins, and color the hexagons accordingly.
4534+ - If a sequence of values, the values of the lower bound of
4535+ the bins to be used.
45394536
4540- xscale : {'linear', 'log'}, optional, default is 'linear'
4537+ xscale : {'linear', 'log'}, default: 'linear'
45414538 Use a linear or log10 scale on the horizontal axis.
45424539
4543- yscale : {'linear', 'log'}, optional, default is 'linear'
4540+ yscale : {'linear', 'log'}, default: 'linear'
45444541 Use a linear or log10 scale on the vertical axis.
45454542
4546- mincnt : int > 0, optional, default is *None*
4543+ mincnt : int > 0, default: *None*
45474544 If not *None*, only display cells with more than *mincnt*
4548- number of points in the cell
4545+ number of points in the cell.
45494546
4550- marginals : bool, optional, default is *False*
4551- if marginals is *True*, plot the marginal density as
4547+ marginals : bool, default: *False*
4548+ If marginals is *True*, plot the marginal density as
45524549 colormapped rectangles along the bottom of the x-axis and
4553- left of the y-axis
4550+ left of the y-axis.
45544551
4555- extent : scalar, optional, default is *None*
4552+ extent : float, default: *None*
45564553 The limits of the bins. The default assigns the limits
45574554 based on *gridsize*, *x*, *y*, *xscale* and *yscale*.
45584555
@@ -4565,54 +4562,67 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
45654562
45664563 Other Parameters
45674564 ----------------
4568- cmap : object, optional, default is *None*
4569- a :class:`matplotlib.colors. Colormap` instance. If *None*,
4570- defaults to rc `` image.cmap` `.
4565+ cmap : str or `~matplotlib.colors.Colormap`, optional
4566+ The Colormap instance or registered colormap name used to map
4567+ the bin values to colors. Defaults to :rc:` image.cmap`.
45714568
4572- norm : object, optional, default is *None*
4573- :class:`matplotlib.colors.Normalize` instance is used to
4574- scale luminance data to (0, 1).
4569+ norm : `~matplotlib.colors.Normalize`, optional
4570+ The Normalize instance scales the bin values to the canonical
4571+ colormap range [0, 1] for mapping to colors. By default, the data
4572+ range is mapped to the colorbar range using linear scaling.
45754573
4576- vmin, vmax : scalar , optional, default is * None*
4577- *vmin* and *vmax* are used in conjunction with *norm* to
4578- normalize luminance data. If *None*, the min and max of the
4579- color array *C* are used. Note if you pass a norm instance
4580- your settings for *vmin* and *vmax* will be ignored .
4574+ vmin, vmax : float , optional, default: None
4575+ The colorbar range. If *None*, suitable min/max values are
4576+ automatically chosen by the `~.Normalize` instance (defaults to
4577+ the respective min/max values of the bins in case of the default
4578+ linear scaling). This is ignored if *norm* is given .
45814579
4582- alpha : scalar between 0 and 1, optional, default is *None*
4583- the alpha value for the patches
4580+ alpha : float between 0 and 1, optional
4581+ The alpha blending value, between 0 (transparent) and 1 (opaque).
45844582
4585- linewidths : scalar, optional, default is *None*
4583+ linewidths : float, default: *None*
45864584 If *None*, defaults to 1.0.
45874585
4588- edgecolors : {'face', 'none', *None*} or color, optional
4586+ edgecolors : {'face', 'none', *None*} or color, default: 'face'
4587+ The color of the hexagon edges. Possible values are:
45894588
4590- If 'face' (the default), draws the edges in the same color as the
4591- fill color.
4589+ - 'face': Draw the edges in the same color as the fill color.
4590+ - 'none': No edges are drawn. This can sometimes lead to unsightly
4591+ unpainted pixels between the hexagons.
4592+ - *None*: Draw outlines in the default color.
4593+ - An explicit matplotlib color.
45924594
4593- If 'none', no edge is drawn; this can sometimes lead to unsightly
4594- unpainted pixels between the hexagons.
4595+ reduce_C_function : callable, default is `numpy.mean`
4596+ The function to aggregate *C* within the bins. It is ignored if
4597+ *C* is not given. This must have the signature::
45954598
4596- If *None*, draws outlines in the default color.
4599+ def reduce_C_function(C: array) -> float
45974600
4598- If a matplotlib color arg, draws outlines in the specified color.
4601+ Commonly used functions are:
4602+
4603+ - `numpy.mean`: average of the points
4604+ - `numpy.sum`: integral of the point values
4605+ - `numpy.max`: value taken from the largest point
4606+
4607+ **kwargs : `~matplotlib.collections.PolyCollection` properties
4608+ All other keyword arguments are passed on to `.PolyCollection`:
4609+
4610+ %(PolyCollection)s
45994611
46004612 Returns
46014613 -------
4602- polycollection
4603- A `.PolyCollection` instance; use `.PolyCollection.get_array` on
4604- this to get the counts in each hexagon.
4614+ polycollection : `~matplotlib.collections.PolyCollection`
4615+ A `.PolyCollection` defining the hexagonal bins.
4616+
4617+ - `.PolyCollection.get_offset` contains a Mx2 array containing
4618+ the x, y positions of the M hexagon centers.
4619+ - `.PolyCollection.get_array` contains the values of the M
4620+ hexagons.
46054621
46064622 If *marginals* is *True*, horizontal
46074623 bar and vertical bar (both PolyCollections) will be attached
46084624 to the return collection as attributes *hbar* and *vbar*.
46094625
4610- Notes
4611- -----
4612- The standard descriptions of all the
4613- :class:`~matplotlib.collections.Collection` parameters:
4614-
4615- %(Collection)s
46164626 """
46174627 self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
46184628
0 commit comments