MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / ExploringNormalizations

Function ExploringNormalizations

DemoPrograms/Demo_Matplotlib_Browser.py:641–665  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

639 return fig
640
641def ExploringNormalizations():
642 import matplotlib.pyplot as plt
643 import matplotlib.colors as mcolors
644 import numpy as np
645 from numpy.random import multivariate_normal
646
647 data = np.vstack([
648 multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000),
649 multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000)
650 ])
651
652 gammas = [0.8, 0.5, 0.3]
653
654 fig, axes = plt.subplots(nrows=2, ncols=2)
655
656 axes[0, 0].set_title('Linear normalization')
657 axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100)
658
659 for ax, gamma in zip(axes.flat[1:], gammas):
660 ax.set_title(r'Power law $(\gamma=%1.1f)$' % gamma)
661 ax.hist2d(data[:, 0], data[:, 1],
662 bins=100, norm=mcolors.PowerNorm(gamma))
663
664 fig.tight_layout()
665 return fig
666
667def PyplotFormatstr():
668

Callers

nothing calls this directly

Calls 1

set_titleMethod · 0.80

Tested by

no test coverage detected