本文整理汇总了Python中histogram.Histogram.smooth方法的典型用法代码示例。如果您正苦于以下问题:Python Histogram.smooth方法的具体用法?Python Histogram.smooth怎么用?Python Histogram.smooth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类histogram.Histogram
的用法示例。
在下文中一共展示了Histogram.smooth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_hist2d
# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import smooth [as 别名]
def test_plot_hist2d():
npoints = 100000
h2 = Histogram((100,(0,10),'x'),(100,(0,10),'y'),'z','title')
h2.fill(rand.normal(5,2,npoints),
rand.uniform(0,10,npoints))
fig,ax = pyplot.subplots(1,2)
ax[0].plothist(h2)
ax[1].plothist(h2)
ax[1].plothist(h2.smooth(1), style='contour', overlay=True)
pyplot.savefig('test_images/test_plotting_fig_hist2d.png')
示例2: rc
# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import smooth [as 别名]
import numpy as np
from matplotlib import pyplot, rc, cm
from histogram import Histogram
rc('font', family=['Liberation Serif', 'DejaVu Serif', 'Arial'])
np.random.seed(1)
dx = (80, [0,10], 'x (cm)')
dy = (40, [-5,5], 'ε (J/cm$^2$)')
h = Histogram(dx, dy, 'counts', 'Random Data')
npoints = 10000
datax = np.random.normal(5,1,npoints)
datay = np.random.uniform(-5,5,npoints)
h.fill(datax, datay)
fig,ax = pyplot.subplots(1,3, figsize=(10,3))
fig.subplots_adjust(left=.06,bottom=.17,right=.95,top=.88,wspace=.52)
pt0 = ax[0].plothist(h, cmap=cm.GnBu)
pt1 = ax[1].plothist(h, cmap=cm.GnBu, style='contour', filled=True)
pt3a = ax[2].plothist(h, cmap=cm.GnBu)
pt3b = ax[2].plothist(h.smooth(1), overlay=True,
style='contour', colors='black', levels=3)
pyplot.show()