Skip to content

Add note about hist2d resetting axis limits #11071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2018
Merged
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
31 changes: 16 additions & 15 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6462,21 +6462,21 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
- If int, the number of bins for the two dimensions
(nx=ny=bins).

- If [int, int], the number of bins in each dimension
- If ``[int, int]``, the number of bins in each dimension
(nx, ny = bins).

- If array_like, the bin edges for the two dimensions
(x_edges=y_edges=bins).

- If [array, array], the bin edges in each dimension
- If ``[array, array]``, the bin edges in each dimension
(x_edges, y_edges = bins).

The default value is 10.

range : array_like shape(2, 2), optional, default: None
The leftmost and rightmost edges of the bins along each dimension
(if not specified explicitly in the bins parameters): [[xmin,
xmax], [ymin, ymax]]. All values outside of this range will be
(if not specified explicitly in the bins parameters): ``[[xmin,
xmax], [ymin, ymax]]``. All values outside of this range will be
considered outliers and not tallied in the histogram.

normed : bool, optional, default: False
Expand Down Expand Up @@ -6510,31 +6510,32 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
Other Parameters
----------------
cmap : Colormap or str, optional
A :class:`matplotlib.colors.Colormap` instance. If not set, use rc
settings.
A `.colors.Colormap` instance. If not set, use rc settings.

norm : Normalize, optional
A :class:`matplotlib.colors.Normalize` instance is used to
A `.colors.Normalize` instance is used to
scale luminance data to ``[0, 1]``. If not set, defaults to
``Normalize()``.
`.colors.Normalize()`.

vmin/vmax : None or scalar, optional
Arguments passed to the `Normalize` instance.
Arguments passed to the `~.colors.Normalize` instance.

alpha : ``0 <= scalar <= 1`` or ``None``, optional
The alpha blending value.

See also
--------
hist : 1D histogram
hist : 1D histogram plotting

Notes
-----
Rendering the histogram with a logarithmic color scale is
accomplished by passing a :class:`colors.LogNorm` instance to
the *norm* keyword argument. Likewise, power-law normalization
(similar in effect to gamma correction) can be accomplished with
:class:`colors.PowerNorm`.
- Currently ``hist2d`` calculates it's own axis limits, and any limits
previously set are ignored.
- Rendering the histogram with a logarithmic color scale is
accomplished by passing a `.colors.LogNorm` instance to the *norm*
keyword argument. Likewise, power-law normalization (similar
in effect to gamma correction) can be accomplished with
`.colors.PowerNorm`.
"""

h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
Expand Down