.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/scales/power_norm.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:here  to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_scales_power_norm.py: ======================== Exploring normalizations ======================== Various normalization on a multivariate normal distribution. .. GENERATED FROM PYTHON SOURCE LINES 9-39 .. code-block:: default import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np from numpy.random import multivariate_normal # Fixing random state for reproducibility. np.random.seed(19680801) data = np.vstack([ multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000), multivariate_normal([30, 20], [[3, 1], [1, 3]], size=1000) ]) gammas = [0.8, 0.5, 0.3] fig, axs = plt.subplots(nrows=2, ncols=2) axs[0, 0].set_title('Linear normalization') axs[0, 0].hist2d(data[:, 0], data[:, 1], bins=100) for ax, gamma in zip(axs.flat[1:], gammas): ax.set_title(r'Power law $(\gamma=%1.1f)$' % gamma) ax.hist2d(data[:, 0], data[:, 1], bins=100, norm=mcolors.PowerNorm(gamma)) fig.tight_layout() plt.show() .. image:: /gallery/scales/images/sphx_glr_power_norm_001.png :alt: Linear normalization, Power law $(\gamma=0.8)$, Power law $(\gamma=0.5)$, Power law $(\gamma=0.3)$ :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 40-47 ------------ References """""""""" The use of the following functions, methods, classes and modules is shown in this example: .. GENERATED FROM PYTHON SOURCE LINES 48-54 .. code-block:: default import matplotlib matplotlib.colors matplotlib.colors.PowerNorm matplotlib.axes.Axes.hist2d matplotlib.pyplot.hist2d .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. _sphx_glr_download_gallery_scales_power_norm.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:Download Python source code: power_norm.py  .. container:: sphx-glr-download sphx-glr-download-jupyter :download:Download Jupyter notebook: power_norm.ipynb  .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery _