MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / hist2d

Method hist2d

lib/matplotlib/axes/_axes.py:7794–7899  ·  view source on GitHub ↗

Make a 2D histogram plot. Parameters ---------- x, y : array-like, shape (n, ) Input values bins : None or int or [int, int] or array-like or [array, array] The bin specification: - If int, the number of bins for the tw

(self, x, y, bins=10, range=None, density=False, weights=None,
               cmin=None, cmax=None, **kwargs)

Source from the content-addressed store, hash-verified

7792 @_preprocess_data(replace_names=["x", "y", "weights"])
7793 @_docstring.interpd
7794 def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
7795 cmin=None, cmax=None, **kwargs):
7796 """
7797 Make a 2D histogram plot.
7798
7799 Parameters
7800 ----------
7801 x, y : array-like, shape (n, )
7802 Input values
7803
7804 bins : None or int or [int, int] or array-like or [array, array]
7805
7806 The bin specification:
7807
7808 - If int, the number of bins for the two dimensions
7809 (``nx = ny = bins``).
7810 - If ``[int, int]``, the number of bins in each dimension
7811 (``nx, ny = bins``).
7812 - If array-like, the bin edges for the two dimensions
7813 (``x_edges = y_edges = bins``).
7814 - If ``[array, array]``, the bin edges in each dimension
7815 (``x_edges, y_edges = bins``).
7816
7817 The default value is 10.
7818
7819 range : array-like shape(2, 2), optional
7820 The leftmost and rightmost edges of the bins along each dimension
7821 (if not specified explicitly in the bins parameters): ``[[xmin,
7822 xmax], [ymin, ymax]]``. All values outside of this range will be
7823 considered outliers and not tallied in the histogram.
7824
7825 density : bool, default: False
7826 Normalize histogram. See the documentation for the *density*
7827 parameter of `~.Axes.hist` for more details.
7828
7829 weights : array-like, shape (n, ), optional
7830 An array of values w_i weighing each sample (x_i, y_i).
7831
7832 cmin, cmax : float, default: None
7833 All bins that has count less than *cmin* or more than *cmax* will not be
7834 displayed (set to NaN before passing to `~.Axes.pcolormesh`) and these count
7835 values in the return value count histogram will also be set to nan upon
7836 return.
7837
7838 Returns
7839 -------
7840 h : 2D array
7841 The bi-dimensional histogram of samples x and y. Values in x are
7842 histogrammed along the first dimension and values in y are
7843 histogrammed along the second dimension.
7844 xedges : 1D array
7845 The bin edges along the x-axis.
7846 yedges : 1D array
7847 The bin edges along the y-axis.
7848 image : `~.matplotlib.collections.QuadMesh`
7849
7850 Other Parameters
7851 ----------------

Callers 9

hist2dFunction · 0.80
test_hist2dMethod · 0.80
test_hist2dFunction · 0.80
test_hist2d_transposeFunction · 0.80
test_hist2d_densityFunction · 0.80
test_hist2d_autolimitsFunction · 0.80
hist2d.pyFile · 0.80
hist.pyFile · 0.80
power_norm.pyFile · 0.80

Calls 1

pcolormeshMethod · 0.95

Tested by 5

test_hist2dMethod · 0.64
test_hist2dFunction · 0.64
test_hist2d_transposeFunction · 0.64
test_hist2d_densityFunction · 0.64
test_hist2d_autolimitsFunction · 0.64