| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../../gallery/misc/../mplot3d/../scales/power_norm.html | [Back] [Original] |
Section Navigation
fill_between with transparencyhisttype settingsplt.subplotsfloating_axes featuresNote
Go to the end to download the full example code.
Various normalization on a multivariate normal distribution.
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import multivariate_normal
import matplotlib.colors as mcolors
# 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()
[Linear normalization, Power law $(\gamma=0.8)$, Power law $(\gamma=0.5)$, Power law $(\gamma=0.3)$]References
The use of the following functions, methods, classes and modules is shown in this example:
Total running time of the script: (0 minutes 1.097 seconds)
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-1-g879ad8ebba.
Built with the PyData Sphinx Theme 0.16.1.
| Web Proxy Viewer | New URL | Original Page |