Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix #4487: Take hist bins from rcParam
  • Loading branch information
mdboom committed Nov 17, 2015
commit f1b89b209e9898e7f87ba3cb4f41b62aab6c82ed
11 changes: 8 additions & 3 deletions 11 lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5684,7 +5684,7 @@ def table(self, **kwargs):

@unpack_labeled_data(replace_names=["x", 'weights'], label_namer="x")
@docstring.dedent_interpd
def hist(self, x, bins=10, range=None, normed=False, weights=None,
def hist(self, x, bins=None, range=None, normed=False, weights=None,
cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False,
color=None, label=None, stacked=False,
Expand All @@ -5710,14 +5710,16 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
Input values, this takes either a single array or a sequency of
arrays which are not required to be of the same length

bins : integer or array_like, optional
bins : integer or array_like or 'auto', optional
If an integer is given, `bins + 1` bin edges are returned,
consistently with :func:`numpy.histogram` for numpy version >=
1.3.

Unequally spaced bins are supported if `bins` is a sequence.

default is 10
If Numpy 1.11 is installed, may also be ``'auto'``.

Default is taken from the rcParam ``hist.bins``.

range : tuple or None, optional
The lower and upper range of the bins. Lower and upper outliers
Expand Down Expand Up @@ -5879,6 +5881,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
if np.isscalar(x):
x = [x]

if bins is None:
bins = rcParams['hist.bins']

# xrange becomes range after 2to3
bin_range = range
range = __builtins__["range"]
Expand Down
3 changes: 3 additions & 0 deletions 3 lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ def validate_cycler(s):
'patch.facecolor': ['b', validate_color], # blue
'patch.antialiased': [True, validate_bool], # antialiased (no jaggies)

## Histogram properties
'hist.bins': [10, validate_any],

## Boxplot properties
'boxplot.notch': [False, validate_bool],
'boxplot.vertical': [True, validate_bool],
Expand Down
5 changes: 5 additions & 0 deletions 5 matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ backend : %(backend)s
### ERRORBAR PLOTS
#errorbar.capsize : 3 # length of end cap on error bars in pixels

### HISTOGRAM PLOTS
#hist.bins : 10 # The default number of histogram bins.
# If Numpy 1.11 or later is
# installed, may also be `auto`

### Agg rendering
### Warning: experimental, 2008/10/10
#agg.path.chunksize : 0 # 0 to disable; values in the range
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.