# 探索规范化 多元正态分布的各种归一化。 ```python import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np from numpy.random import multivariate_normal data = np.vstack([ multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000), multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000) ]) gammas = [0.8, 0.5, 0.3] fig, axes = plt.subplots(nrows=2, ncols=2) axes[0, 0].set_title('Linear normalization') axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100) for ax, gamma in zip(axes.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() ``` ![探索规范化示例](https://matplotlib.org/_images/sphx_glr_power_norm_001.png) ## 参考 此示例中显示了以下函数,方法,类和模块的使用: ```python import matplotlib matplotlib.colors matplotlib.colors.PowerNorm matplotlib.axes.Axes.hist2d matplotlib.pyplot.hist2d ``` ## 下载这个示例 - [下载python源码: power_norm.py](https://matplotlib.org/_downloads/power_norm.py) - [下载Jupyter notebook: power_norm.ipynb](https://matplotlib.org/_downloads/power_norm.ipynb)