plot ErrorBar
来源:互联网 发布:载入java vm出现错误2 编辑:程序博客网 时间:2024/05/12 20:19
<pre name="code" class="python">#quote from MIT 'introduction to computation and programming using python, Revised'import randomimport pylabdef stdDev(X): mean = sum(X)/len(X) tot = 0.0 for x in X: tot += (x-mean)**2 return (tot/len(X))**0.5 def flipSim(flipsPerTrial, numTrials): fracHeads = [] for n in range(numTrials): heads = 0 for f in range(flipsPerTrial): if random.random() < 0.5: heads += 1 fracHeads.append(heads/float(flipsPerTrial)) mean = sum(fracHeads)/len(fracHeads) sd = stdDev(fracHeads) return (fracHeads, mean, sd) def showErrorBars(minExp, maxExp, numTrials): """Assumes minExp and maxExp positive ints; minExp < maxExp numTrials a positive integer Plots mean fraction of heads with error bars""" means, sds = [], [] xVals = [] for exp in range(minExp, maxExp + 1): xVals.append(2**exp) fracHeads, mean, sd = flipSim(2**exp, numTrials) means.append(mean) sds.append(sd) pylab.errorbar(xVals, means, yerr=2*pylab.array(sds)) pylab.semilogx() pylab.title('Mean Fraction of Heads (' + str(numTrials) + ' trials)') pylab.xlabel('Number of flips per trial') pylab.ylabel('Fraction of heads & 95% confidence')showErrorBars(3, 10, 100)pylab.show()
0 0
- plot ErrorBar
- plot
- matlab中errorbar和shadedErrorBar
- Matlab_learning_0(linspace,std,size,ones,errorbar)
- matplotlib.axes.Axes.errorbar 误差bar图像
- MATLAB PLOT
- Matlab plot
- plot用法
- Core Plot
- plot函数
- matlab plot
- 【matlab】plot
- matlab plot
- plot函数
- IDL plot
- matlab plot
- GNU plot
- matlab plot
- PHP自学笔记详细版本(一)
- jquery的ajax的使用!
- LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- android setTag (int key, Object tag)抛出IllegalArgumentException的问题
- Android中关于Activity/ActionBarActivity/AppCompatActivity的区分与理解
- plot ErrorBar
- int main(int argc,char** argv)
- 该项不适于在指定状态下使用
- 如何精准地反推网游中的数值?
- tomcat 修改默认项目路径和虚拟路径
- 销售学习资料
- find
- 关于英特尔® 处理器显卡技术
- Qt5之于Qt4的发展