Compute the multidimensional histogram of some data. Parameters ---------- sample : (N, D) array, or (N, D) array_like The data to be histogrammed. Note the unusual interpretation of sample when an array_like: * When an array, each row is a coordinate in a
(sample, bins=10, range=None, density=None, weights=None)
| 912 | |
| 913 | @array_function_dispatch(_histogramdd_dispatcher) |
| 914 | def histogramdd(sample, bins=10, range=None, density=None, weights=None): |
| 915 | """ |
| 916 | Compute the multidimensional histogram of some data. |
| 917 | |
| 918 | Parameters |
| 919 | ---------- |
| 920 | sample : (N, D) array, or (N, D) array_like |
| 921 | The data to be histogrammed. |
| 922 | |
| 923 | Note the unusual interpretation of sample when an array_like: |
| 924 | |
| 925 | * When an array, each row is a coordinate in a D-dimensional space - |
| 926 | such as ``histogramdd(np.array([p1, p2, p3]))``. |
| 927 | * When an array_like, each element is the list of values for single |
| 928 | coordinate - such as ``histogramdd((X, Y, Z))``. |
| 929 | |
| 930 | The first form should be preferred. |
| 931 | |
| 932 | bins : sequence or int, optional |
| 933 | The bin specification: |
| 934 | |
| 935 | * A sequence of arrays describing the monotonically increasing bin |
| 936 | edges along each dimension. |
| 937 | * The number of bins for each dimension (nx, ny, ... =bins) |
| 938 | * The number of bins for all dimensions (nx=ny=...=bins). |
| 939 | |
| 940 | range : sequence, optional |
| 941 | A sequence of length D, each an optional (lower, upper) tuple giving |
| 942 | the outer bin edges to be used if the edges are not given explicitly in |
| 943 | `bins`. |
| 944 | An entry of None in the sequence results in the minimum and maximum |
| 945 | values being used for the corresponding dimension. |
| 946 | The default, None, is equivalent to passing a tuple of D None values. |
| 947 | density : bool, optional |
| 948 | If False, the default, returns the number of samples in each bin. |
| 949 | If True, returns the probability *density* function at the bin, |
| 950 | ``bin_count / sample_count / bin_volume``. |
| 951 | weights : (N,) array_like, optional |
| 952 | An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`. |
| 953 | Weights are normalized to 1 if density is True. If density is False, |
| 954 | the values of the returned histogram are equal to the sum of the |
| 955 | weights belonging to the samples falling into each bin. |
| 956 | |
| 957 | Returns |
| 958 | ------- |
| 959 | H : ndarray |
| 960 | The multidimensional histogram of sample x. See density and weights |
| 961 | for the different possible semantics. |
| 962 | edges : tuple of ndarrays |
| 963 | A tuple of D arrays describing the bin edges for each dimension. |
| 964 | |
| 965 | See Also |
| 966 | -------- |
| 967 | histogram: 1-D histogram |
| 968 | histogram2d: 2-D histogram |
| 969 | |
| 970 | Examples |
| 971 | -------- |
searching dependent graphs…