@@ -6778,7 +6778,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
6778
6778
return tops , bins , cbook .silent_list ('Lists of Patches' , patches )
6779
6779
6780
6780
@_preprocess_data (replace_names = ["x" , "y" , "weights" ], label_namer = None )
6781
- def hist2d (self , x , y , bins = 10 , range = None , normed = False , weights = None ,
6781
+ def hist2d (self , x , y , bins = 10 , range = None , density = None , normed = None , weights = None ,
6782
6782
cmin = None , cmax = None , ** kwargs ):
6783
6783
"""
6784
6784
Make a 2D histogram plot.
@@ -6812,11 +6812,22 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
6812
6812
xmax], [ymin, ymax]]``. All values outside of this range will be
6813
6813
considered outliers and not tallied in the histogram.
6814
6814
6815
- normed : bool, optional, default: False
6816
- Normalize histogram.
6815
+ density : boolean, optional
6816
+ If False, the default, returns the number of samples in each bin.
6817
+ If True, returns the probability *density* function at the bin,
6818
+ ``bin_count / sample_count / bin_area``.
6819
+
6820
+ Default is ``None`` for both *normed* and *density*. If either is
6821
+ set, then that value will be used. If neither are set, then the
6822
+ args will be treated as ``False``.
6823
+ If both *density* and *normed* are set an error is raised.
6824
+
6825
+ normed : bool, optional, default: None
6826
+ Deprecated; use the density keyword argument instead.
6827
+
6817
6828
6818
6829
weights : array_like, shape (n, ), optional, default: None
6819
- An array of values w_i weighing each sample (x_i, y_i).
6830
+ An array of values w_i weighing each sample (x_i, y_i).
6820
6831
6821
6832
cmin : scalar, optional, default: None
6822
6833
All bins that has count less than cmin will not be displayed and
@@ -6870,7 +6881,16 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
6870
6881
in effect to gamma correction) can be accomplished with
6871
6882
`.colors.PowerNorm`.
6872
6883
"""
6873
-
6884
+ if density is not None and normed is not None :
6885
+ raise ValueError ("kwargs 'density' and 'normed' cannot be used "
6886
+ "simultaneously. "
6887
+ "Please only use 'density', since 'normed'"
6888
+ "is deprecated." )
6889
+ if normed is not None :
6890
+ cbook .warn_deprecated ("2.1" , name = "'normed'" , obj_type = "kwarg" ,
6891
+ alternative = "'density'" , removal = "3.1" )
6892
+
6893
+ normed = bool (density ) or bool (normed )
6874
6894
h , xedges , yedges = np .histogram2d (x , y , bins = bins , range = range ,
6875
6895
normed = normed , weights = weights )
6876
6896
0 commit comments