Movatterモバイル変換


[0]ホーム

URL:


You are reading an old version of the documentation (v2.0.0). For the latest version seehttps://matplotlib.org/stable/
matplotlib

Navigation


Travis-CI:

Related Topics

This Page

Quick search

api example code: power_norm_demo.py

(Source code,png,pdf)

../../_images/power_norm_demo.png
"""========================Exploring normalizations========================Let's explore various normalization on a multivariate normal distribution."""frommatplotlibimportpyplotaspltimportmatplotlib.colorsasmcolorsimportnumpyasnpfromnumpy.randomimportmultivariate_normaldata=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)forax,gammainzip(axes.flat[1:],gammas):ax.set_title('Power law $(\gamma=%1.1f)$'%gamma)ax.hist2d(data[:,0],data[:,1],bins=100,norm=mcolors.PowerNorm(gamma))fig.tight_layout()plt.show()

Keywords: python, matplotlib, pylab, example, codex (seeSearch examples)

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team. Last updated on Feb 20, 2017. Created usingSphinx 1.5.2.

[8]ページ先頭

©2009-2025 Movatter.jp