+
+
diff --git a/_posts/python/statistical/histogram/histograms.ipynb b/_posts/python/statistical/histogram/histograms.ipynb
index 186a071b3b46..d634f75c26e1 100644
--- a/_posts/python/statistical/histogram/histograms.ipynb
+++ b/_posts/python/statistical/histogram/histograms.ipynb
@@ -20,16 +20,16 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "'2.4.1'"
+ "'3.1.1'"
]
},
- "execution_count": 2,
+ "execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
@@ -48,7 +48,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {},
"outputs": [
{
@@ -60,7 +60,7 @@
"
"
]
},
- "execution_count": 3,
+ "execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@@ -86,7 +86,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -98,7 +98,7 @@
""
]
},
- "execution_count": 4,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@@ -125,7 +125,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -137,7 +137,7 @@
""
]
},
- "execution_count": 5,
+ "execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -158,12 +158,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Overlaid Histgram ###"
+ "### Overlaid Histogram ###"
]
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -175,7 +175,7 @@
""
]
},
- "execution_count": 6,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -214,7 +214,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
@@ -226,7 +226,7 @@
""
]
},
- "execution_count": 7,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -262,19 +262,19 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- ""
+ ""
],
"text/plain": [
""
]
},
- "execution_count": 1,
+ "execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@@ -340,7 +340,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -352,7 +352,7 @@
""
]
},
- "execution_count": 9,
+ "execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -379,7 +379,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -391,7 +391,7 @@
""
]
},
- "execution_count": 11,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -400,7 +400,7 @@
"import plotly.plotly as py\n",
"import plotly.graph_objs as go\n",
"\n",
- "x = [\"Apples\",\"Apples\",\"Apples\",\"Organges\", \"Bananas\"]\n",
+ "x = [\"Apples\",\"Apples\",\"Apples\",\"Oranges\", \"Bananas\"]\n",
"y = [\"5\",\"10\",\"3\",\"10\",\"5\"]\n",
"\n",
"data = [\n",
@@ -421,6 +421,100 @@
"py.iplot(data, filename='binning function')"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Custom Binning\n",
+ "For custom binning along x-axis, use the attribute [`nbinsx`](https://plot.ly/python/reference/#histogram-nbinsx). Please note that the autobin algorithm will choose a 'nice' round bin size that may result in somewhat fewer than `nbinsx` total bins. Alternatively, you can set the exact values for [`xbins`](https://plot.ly/python/reference/#histogram-xbins) along with `autobinx = False`."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "This is the format of your plot grid:\n",
+ "[ (1,1) x1,y1 ] [ (1,2) x2,y2 ]\n",
+ "[ (2,1) x3,y3 ] [ (2,2) x4,y4 ]\n",
+ "[ (3,1) x5,y5 ] [ (3,2) x6,y6 ]\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ ""
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from plotly import tools\n",
+ "import plotly.plotly as py\n",
+ "import plotly.graph_objs as go\n",
+ "\n",
+ "x = ['1970-01-01', '1970-01-01', '1970-02-01', '1970-04-01', '1970-01-02', '1972-01-31', '1970-02-13', '1971-04-19']\n",
+ "\n",
+ "\n",
+ "trace0 = go.Histogram(\n",
+ " x=x,\n",
+ " nbinsx = 4, \n",
+ " )\n",
+ "trace1 = go.Histogram(\n",
+ " x=x,\n",
+ " nbinsx = 8, \n",
+ " )\n",
+ "trace2 = go.Histogram(\n",
+ " x=x,\n",
+ " nbinsx = 10, \n",
+ " )\n",
+ "trace3 = go.Histogram(\n",
+ " x=x,\n",
+ " xbins=dict(\n",
+ " start='1969-11-15',\n",
+ " end='1972-03-31',\n",
+ " size= 'M18'),\n",
+ " autobinx = False\n",
+ ")\n",
+ "trace4 = go.Histogram(\n",
+ " x=x,\n",
+ " xbins=dict(\n",
+ " start='1969-11-15',\n",
+ " end='1972-03-31',\n",
+ " size= 'M4'),\n",
+ " autobinx = False\n",
+ ")\n",
+ "trace5 = go.Histogram(\n",
+ " x=x,\n",
+ " xbins=dict(\n",
+ " start='1969-11-15',\n",
+ " end='1972-03-31',\n",
+ " size= 'M2'),\n",
+ " autobinx = False\n",
+ ")\n",
+ " \n",
+ "fig = tools.make_subplots(rows=3, cols=2)\n",
+ "fig.append_trace(trace0, 1, 1)\n",
+ "fig.append_trace(trace1, 1, 2)\n",
+ "fig.append_trace(trace2, 2, 1)\n",
+ "fig.append_trace(trace3, 2, 2)\n",
+ "fig.append_trace(trace4, 3, 1)\n",
+ "fig.append_trace(trace5, 3, 2)\n",
+ "\n",
+ "py.iplot(fig, filename='custom binning')"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -431,7 +525,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 12,
"metadata": {},
"outputs": [
{
@@ -463,10 +557,11 @@
"output_type": "stream",
"text": [
"Collecting git+https://github.com/plotly/publisher.git\n",
- " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-req-build-vLqig0\n",
+ " Cloning https://github.com/plotly/publisher.git to c:\\users\\thars\\appdata\\local\\temp\\pip-req-build-m55txi\n",
"Building wheels for collected packages: publisher\n",
- " Running setup.py bdist_wheel for publisher ... \u001b[?25ldone\n",
- "\u001b[?25h Stored in directory: /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-ephem-wheel-cache-mKb20V/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n",
+ " Running setup.py bdist_wheel for publisher: started\n",
+ " Running setup.py bdist_wheel for publisher: finished with status 'done'\n",
+ " Stored in directory: c:\\users\\thars\\appdata\\local\\temp\\pip-ephem-wheel-cache-dfu9fo\\wheels\\99\\3e\\a0\\fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n",
"Successfully built publisher\n",
"Installing collected packages: publisher\n",
" Found existing installation: publisher 0.11\n",
@@ -474,20 +569,6 @@
" Successfully uninstalled publisher-0.11\n",
"Successfully installed publisher-0.11\n"
]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/nbconvert.py:13: ShimWarning:\n",
- "\n",
- "The `IPython.nbconvert` package has been deprecated since IPython 4.0. You should import from nbconvert instead.\n",
- "\n",
- "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/publisher/publisher.py:53: UserWarning:\n",
- "\n",
- "Did you \"Save\" this notebook before running this command? Remember to save, always save.\n",
- "\n"
- ]
}
],
"source": [
@@ -513,9 +594,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": []
}
@@ -537,7 +616,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
- "version": "2.7.12"
+ "version": "2.7.14"
}
},
"nbformat": 4,