diff --git a/matplotlib/matplotlib.ipynb b/matplotlib/matplotlib.ipynb index d603fb7..59a389c 100644 --- a/matplotlib/matplotlib.ipynb +++ b/matplotlib/matplotlib.ipynb @@ -461,6 +461,52 @@ } ], "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Histograms" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Gaussian, mean 1, stddev .5, 1000 elements\n", + "samples = np.random.normal(loc=1.0, scale=0.5, size=1000)\n", + "print(samples.shape)\n", + "print(samples.dtype)\n", + "print(samples[:30])\n", + "plt.hist(samples, bins=50);\n", + "plt.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(1000,)\n", + "float64\n", + "[ 0.78414546 0.7624507 0.79832022 1.43772119 0.6277384 0.95119108\n", + " 0.86033247 2.05204185 1.34378449 0.51229619 2.08940893 1.96080879\n", + " 0.90780563 0.82401283 0.63668015 1.50731702 1.52091633 0.59678776\n", + " 0.5543333 0.67782493 0.64534513 0.87408671 0.99390343 1.81493002\n", + " 0.46069816 1.31869943 1.26709913 1.96472827 0.97586513 0.96092536]\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAAE5CAYAAABWGr4wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFT5JREFUeJzt3W+Mpdd9F/DvJtlJMuwweFezEaxXC9o6R65KSw1SUYls\np7ihBmpHlVBFW4tGRTTUL0ypHCVu8IuqIhVmI22kEIFJ2FIgWDGhOFROI9IobqPyP9Bado8bCLtj\nyfJud9ZjjyfO/pnhxcw64/Xu3OfOuffOvXc+H8ny3PuceZ7fnD1757v3Oeeefevr6wEAYOfestsF\nAABMOoEKAKCRQAUA0EigAgBoJFABADQSqAAAGr2tS6NSyv9Msrz58P8m+ViSU0nWkjyd5P5aq89f\nAAD2pJ6BqpTyjiSptb53y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