22 unicode_literals )
33
44import six
5- from six .moves import reduce , xrange , zip
5+ from six .moves import reduce , xrange , zip , zip_longest
66
77import math
88import warnings
9- import itertools
109
1110import numpy as np
1211from numpy import ma
@@ -5401,14 +5400,16 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54015400 Input values, this takes either a single array or a sequency of
54025401 arrays which are not required to be of the same length
54035402
5404- bins : integer or array_like, optional, default: 10
5403+ bins : integer or array_like, optional
54055404 If an integer is given, `bins + 1` bin edges are returned,
54065405 consistently with :func:`numpy.histogram` for numpy version >=
54075406 1.3.
54085407
54095408 Unequally spaced bins are supported if `bins` is a sequence.
54105409
5411- range : tuple, optional, default: None
5410+ default is 10
5411+
5412+ range : tuple or None, optional
54125413 The lower and upper range of the bins. Lower and upper outliers
54135414 are ignored. If not provided, `range` is (x.min(), x.max()). Range
54145415 has no effect if `bins` is a sequence.
@@ -5417,20 +5418,26 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54175418 is based on the specified bin range instead of the
54185419 range of x.
54195420
5420- normed : boolean, optional, default: False
5421+ Default is ``None``
5422+
5423+ normed : boolean, optional
54215424 If `True`, the first element of the return tuple will
54225425 be the counts normalized to form a probability density, i.e.,
54235426 ``n/(len(x)`dbin)``, i.e., the integral of the histogram will sum
54245427 to 1. If *stacked* is also *True*, the sum of the histograms is
54255428 normalized to 1.
54265429
5427- weights : array_like, shape (n, ), optional, default: None
5430+ Default is ``False``
5431+
5432+ weights : (n, ) array_like or None, optional
54285433 An array of weights, of the same shape as `x`. Each value in `x`
54295434 only contributes its associated weight towards the bin count
54305435 (instead of 1). If `normed` is True, the weights are normalized,
54315436 so that the integral of the density over the range remains 1.
54325437
5433- cumulative : boolean, optional, default : False
5438+ Default is ``None``
5439+
5440+ cumulative : boolean, optional
54345441 If `True`, then a histogram is computed where each bin gives the
54355442 counts in that bin plus all bins for smaller values. The last bin
54365443 gives the total number of datapoints. If `normed` is also `True`
@@ -5440,13 +5447,17 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54405447 `True`, then the histogram is normalized such that the first bin
54415448 equals 1.
54425449
5443- bottom : array_like, scalar, or None, default: None
5450+ Default is ``False``
5451+
5452+ bottom : array_like, scalar, or None
54445453 Location of the bottom baseline of each bin. If a scalar,
54455454 the base line for each bin is shifted by the same amount.
54465455 If an array, each bin is shifted independently and the length
54475456 of bottom must match the number of bins. If None, defaults to 0.
54485457
5449- histtype : ['bar' | 'barstacked' | 'step' | 'stepfilled'], optional
5458+ Default is ``None``
5459+
5460+ histtype : {'bar', 'barstacked', 'step', 'stepfilled'}, optional
54505461 The type of histogram to draw.
54515462
54525463 - 'bar' is a traditional bar-type histogram. If multiple data
@@ -5461,7 +5472,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54615472 - 'stepfilled' generates a lineplot that is by default
54625473 filled.
54635474
5464- align : ['left' | 'mid' | 'right'], optional, default: 'mid'
5475+ Default is 'bar'
5476+
5477+ align : {'left', 'mid', 'right'}, optional
54655478 Controls how the histogram is plotted.
54665479
54675480 - 'left': bars are centered on the left bin edges.
@@ -5470,34 +5483,47 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54705483
54715484 - 'right': bars are centered on the right bin edges.
54725485
5473- orientation : ['horizontal' | 'vertical'], optional
5486+ Default is 'mid'
5487+
5488+ orientation : {'horizontal', 'vertical'}, optional
54745489 If 'horizontal', `~matplotlib.pyplot.barh` will be used for
54755490 bar-type histograms and the *bottom* kwarg will be the left edges.
54765491
5477- rwidth : scalar, optional, default: None
5492+ rwidth : scalar or None, optional
54785493 The relative width of the bars as a fraction of the bin width. If
5479- `None`, automatically compute the width. Ignored if `histtype` =
5480- 'step' or 'stepfilled'.
5494+ `None`, automatically compute the width.
54815495
5482- log : boolean, optional, default : False
5496+ Ignored if `histtype` is 'step' or 'stepfilled'.
5497+
5498+ Default is ``None``
5499+
5500+ log : boolean, optional
54835501 If `True`, the histogram axis will be set to a log scale. If `log`
54845502 is `True` and `x` is a 1D array, empty bins will be filtered out
54855503 and only the non-empty (`n`, `bins`, `patches`) will be returned.
54865504
5487- color : color or array_like of colors, optional, default: None
5505+ Default is ``False``
5506+
5507+ color : color or array_like of colors or None, optional
54885508 Color spec or sequence of color specs, one per dataset. Default
54895509 (`None`) uses the standard line color sequence.
54905510
5491- label : string, optional, default: ''
5511+ Default is ``None``
5512+
5513+ label : string or None, optional
54925514 String, or sequence of strings to match multiple datasets. Bar
54935515 charts yield multiple patches per dataset, but only the first gets
54945516 the label, so that the legend command will work as expected.
54955517
5496- stacked : boolean, optional, default : False
5518+ default is ``None``
5519+
5520+ stacked : boolean, optional
54975521 If `True`, multiple data are stacked on top of each other If
54985522 `False` multiple data are aranged side by side if histtype is
54995523 'bar' or on top of each other if histtype is 'step'
55005524
5525+ Default is ``False``
5526+
55015527 Returns
55025528 -------
55035529 n : array or list of arrays
@@ -5853,16 +5879,10 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
58535879 labels = [None ]
58545880 elif is_string_like (label ):
58555881 labels = [label ]
5856- elif is_sequence_of_strings (label ):
5857- labels = list (label )
58585882 else :
5859- raise ValueError (
5860- 'invalid label: must be string or sequence of strings' )
5861-
5862- if len (labels ) < nx :
5863- labels += [None ] * (nx - len (labels ))
5883+ labels = [str (lab ) for lab in label ]
58645884
5865- for (patch , lbl ) in zip (patches , labels ):
5885+ for (patch , lbl ) in zip_longest (patches , labels , fillvalue = None ):
58665886 if patch :
58675887 p = patch [0 ]
58685888 p .update (kwargs )
0 commit comments