Created
January 24, 2018 17:34
-
-
Save infinite-Joy9l/d031885ecbfe0eb7d8c90992d19921e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from sklearn.datasets import load_iris\n", | |
"import matplotlib.pyplot as plt\n", | |
"%matplotlib inline\n", | |
"data = load_iris()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"X_sepal_length = data.data[:,0]\n", | |
"X_sepal_width = data.data[:,1]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(150,)" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"X_sepal_length.shape" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEWCAYAAAB1xKBvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGG9JREFUeJzt3Xu0XnV95/H3xwA6XBQdziC3GJxmsYpWEdNoFS0IOgSp\njDO2wqqKt4latGrtsvFSta3TMr04U8VKU6F4xVtFaQkoWBl01VtA7oimlEsCkqBjuEjV4Hf+eHbk\n4eE8Ob+TnOc8T5L3a62zzt7799t7f7OVfLJvv52qQpKkmTxk3AVIkrYPBoYkqYmBIUlqYmBIkpoY\nGJKkJgaGJKmJgaGdWpLTk/zhHG1rYZK7kyzo5i9O8sq52Ha3vfOTnDxX25N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A9cOdBv78YS2WifhmPY5ieGX\neSbimHaG1jkhx/Nm4KlJdu9qOZrewzn9tul4+pTUHMgDhzV5AfCaJJuAe4ETazyv0+8LnNP9f3gX\n4ONVdUEmbwiWljon5Zi+DvhYd2niBuBlE3g8N5up1ok4pt0/Ep4NvKpv2cQd04Y6x348q+obST5D\n7/LYJuDbwMq5PJ4ODSJJauIlKUlSEwNDktTEwJAkNTEwJElNDAxJUhMDQ9oKSd6W3qigV6Y3Oumc\nDYiX3sinDxoJWRo338OQZim9ocKPBw6vqp90b/TuNuaypJHzDEOavf2AO6rqJwBVdUdV3ZrkyUn+\nbzeI4hc2jwKa5OIkf92diVzdvQlMkqVJvtYNEPgvfW9mSxPJwJBm74vAQUm+m+Rvkvx6kl3pDTr3\ngqp6MnAm8D/71tm9G2Dxd7o2gO8Az+gGCHwH8Kfz90eQZs9LUtIsVdXdSZ4MPAM4Cvgk8G7g8cCF\n3TAnC+gNMb3Z2d26lyR5eJK9gb2ADyVZTG+I913n708hzZ6BIW2FqroPuBi4OMlVwCnANVX1a8NW\nmWb+T4AvV9XzkyzqtidNLC9JSbOU3jeeF/ctOozeqKBT3Q1xkuw68BGdF3bLj6A3QuhG4BHcP7T0\nS0deuLSNPMOQZm9P4H3dZaVN9Eb+XA6sBN6b3idSd6H3dcZrunX+Pcm36V12enm37M/pXZJ6O3De\nPNYvbRVHq5VGLMnFwO9X1epx1yJtCy9JSZKaeIYhSWriGYYkqYmBIUlqYmBIkpoYGJKkJgaGJKnJ\n/wf85uvmbHVebQAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<matplotlib.figure.Figure at 0x7f0ff0954b00>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"fig=plt.figure() #Plots in matplotlib reside within a figure object, use plt.figure to create new figure\n", | |
"#Create one or more subplots using add_subplot, because you can't create blank figure\n", | |
"ax = fig.add_subplot(1,1,1)\n", | |
"#Variable\n", | |
"ax.hist(X_sepal_length,bins = 15) # Here you can play with number of bins Labels and Tit\n", | |
"plt.title('Distribution')\n", | |
"plt.xlabel('Sepal')\n", | |
"plt.ylabel('length')\n", | |
"plt.show()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python (venv)", | |
"language": "python", | |
"name": "venv" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment