@@ -6773,7 +6773,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
67736773 return tops , bins , cbook .silent_list ('Lists of Patches' , patches )
67746774
67756775 @_preprocess_data (replace_names = ["x" , "y" , "weights" ], label_namer = None )
6776- def hist2d (self , x , y , bins = 10 , range = None , normed = False , weights = None ,
6776+ def hist2d (self , x , y , bins = 10 , range = None , density = None , normed = None , weights = None ,
67776777 cmin = None , cmax = None , ** kwargs ):
67786778 """
67796779 Make a 2D histogram plot.
@@ -6807,11 +6807,22 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
68076807 xmax], [ymin, ymax]]``. All values outside of this range will be
68086808 considered outliers and not tallied in the histogram.
68096809
6810- normed : bool, optional, default: False
6811- Normalize histogram.
6810+ density : boolean, optional
6811+ If False, the default, returns the number of samples in each bin.
6812+ If True, returns the probability *density* function at the bin,
6813+ ``bin_count / sample_count / bin_area``.
6814+
6815+ Default is ``None`` for both *normed* and *density*. If either is
6816+ set, then that value will be used. If neither are set, then the
6817+ args will be treated as ``False``.
6818+ If both *density* and *normed* are set an error is raised.
6819+
6820+ normed : bool, optional, default: None
6821+ Deprecated; use the density keyword argument instead.
6822+
68126823
68136824 weights : array_like, shape (n, ), optional, default: None
6814- An array of values w_i weighing each sample (x_i, y_i).
6825+ An array of values w_i weighing each sample (x_i, y_i).
68156826
68166827 cmin : scalar, optional, default: None
68176828 All bins that has count less than cmin will not be displayed and
@@ -6823,6 +6834,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
68236834 to none before passing to imshow) and these count values in the
68246835 return value count histogram will also be set to nan upon return
68256836
6837+
68266838 Returns
68276839 -------
68286840 h : 2D array
@@ -6865,7 +6877,16 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
68656877 in effect to gamma correction) can be accomplished with
68666878 `.colors.PowerNorm`.
68676879 """
6868-
6880+ if density is not None and normed is not None :
6881+ raise ValueError ("kwargs 'density' and 'normed' cannot be used "
6882+ "simultaneously. "
6883+ "Please only use 'density', since 'normed'"
6884+ "is deprecated." )
6885+ if normed is not None :
6886+ cbook .warn_deprecated ("2.1" , name = "'normed'" , obj_type = "kwarg" ,
6887+ alternative = "'density'" , removal = "3.1" )
6888+
6889+ normed = bool (density ) or bool (normed )
68696890 h , xedges , yedges = np .histogram2d (x , y , bins = bins , range = range ,
68706891 normed = normed , weights = weights )
68716892
0 commit comments