python安装mlab库_Python mlab.normpdf方法代码示例

这篇文章汇总了Python中matplotlib.mlab.normpdf函数的使用方法,包括如何绘制正态分布曲线,结合实际示例进行解析。文章包含多个代码示例,如histogram_demo、plot_t_value_hist等,适用于需要处理正态分布数据的场景。
摘要由CSDN通过智能技术生成

本文整理汇总了Python中matplotlib.mlab.normpdf方法的典型用法代码示例。如果您正苦于以下问题:Python mlab.normpdf方法的具体用法?Python mlab.normpdf怎么用?Python mlab.normpdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块matplotlib.mlab的用法示例。

在下文中一共展示了mlab.normpdf方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: histogram_demo

​点赞 6

# 需要导入模块: from matplotlib import mlab [as 别名]

# 或者: from matplotlib.mlab import normpdf [as 别名]

def histogram_demo(ax):

# example data

mu = 100 # mean of distribution

sigma = 15 # standard deviation of distribution

x = mu + sigma * np.random.randn(10000)

num_bins = 50

# The histogram of the data.

_, bins, _ = ax.hist(x, num_bins, normed=1, label='data')

# Add a 'best fit' line.

y = mlab.normpdf(bins, mu, sigma)

ax.plot(bins, y, '-s', label='best fit')

ax.legend()

ax.set_xlabel('Smarts')

ax.set_ylabel('Probability')

ax.set_title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')

开发者ID:tonysyu,项目名称:matplotlib-style-gallery,代码行数:21,

示例2: plot_t_value_hist

​点赞 6

# 需要导入模块: from matplotlib import mlab [as 别名]

# 或者: from matplotlib.mlab import normpdf [as 别名]

def plot_t_value_hist(

img_path='~/ni_data/ofM.dr/l1/as_composite/sub-5703/ses-ofM/sub-5703_ses-ofM_task-EPI_CBV_chr_longSOA_tstat.nii.gz',

roi_path='~/ni_data/templates/roi/DSURQEc_ctx.nii.gz',

mask_path='/usr/share/mouse-brain-atlases/dsurqec_200micron_mask.nii',

save_as='~/qc_tvalues.pdf',

):

"""Make t-value histogram plot"""

f, axarr = plt.subplots(1, sharex=True)

roi = nib.load(path.expanduser(roi_path))

roi_data = roi.get_data()

mask = nib.load(path.expanduser(mask_path))

mask_data = mask.get_data()

idx = np.nonzero(np.multiply(roi_data,mask_data))

img = nib.load(path.expanduser(img_path))

data = img.get_data()[idx]

(mu, sigma) = norm.fit(data)

n, bins, patches = axarr.hist(data,'auto',normed=1, facecolor='green', alpha=0.75)

y = mlab.normpdf(bins, mu, sigma)

axarr.plot(bins, y, 'r--', linewidth=2)

axarr.set_title('Histogram of t-values $\mathrm{(\mu=%.3f,\ \sigma=%.3f}$)' %(mu, sigma))

axarr.set_xlabel('t-values')

plt.savefig(path.expanduser(save_as))

开发者ID:IBT-FMI,项目名称:SAMRI,代码行数:27,代码来源:qc.py

示例3: plot_z

​点赞 6

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值