Skip to content

Commit

Permalink
Merge 4f8f201 into e8a77ba
Browse files Browse the repository at this point in the history
  • Loading branch information
jbednar committed Jun 30, 2017
2 parents e8a77ba + 4f8f201 commit 02a82fa
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
30 changes: 24 additions & 6 deletions examples/reference/elements/bokeh/Histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``.hist`` method is an easy way to compute a histogram from an existing Element. The method effectively just calls the ``histogram`` operation, which lets you compute a histogram from an Element, and then adjoins the resulting histogram. Here we will create two sets of ``Points``, compute a ``Histogram`` for the 'x' and 'y' dimension on each, which we then overlay and adjoin to the plot."
"The ``.hist`` method is an easy way to compute a histogram from an existing Element:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"points = hv.Points(np.random.randn(100,2))\n",
"\n",
"points.hist(dimension=['x','y'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``.hist`` method is just a convenient wrapper around the ``histogram`` operation that computes a histogram from an Element, and then adjoins the resulting histogram to the main plot. You can also do this process manually; here we create an additional set of ``Points``, compute a ``Histogram`` for the 'x' and 'y' dimension on each, and then overlay them and adjoin to the plot."
]
},
{
Expand All @@ -78,12 +96,12 @@
"source": [
"%%opts Histogram (alpha=0.3)\n",
"from holoviews.operation import histogram\n",
"points1 = hv.Points(np.random.randn(100,2)*2+1)\n",
"points2 = hv.Points(np.random.randn(100,2))\n",
"xhist, yhist = (histogram(points1, bin_range=(-5, 5), dimension=dim) *\n",
" histogram(points2, bin_range=(-5, 5), dimension=dim) \n",
"points2 = hv.Points(np.random.randn(100,2)*2+1)\n",
"\n",
"xhist, yhist = (histogram(points2, bin_range=(-5, 5), dimension=dim) *\n",
" histogram(points, bin_range=(-5, 5), dimension=dim) \n",
" for dim in 'xy')\n",
"(points1 * points2) << yhist(plot=dict(width=125)) << xhist(plot=dict(height=125))"
"(points2 * points) << yhist(plot=dict(width=125)) << xhist(plot=dict(height=125))"
]
}
],
Expand Down
30 changes: 24 additions & 6 deletions examples/reference/elements/matplotlib/Histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``.hist`` method is an easy way to compute a histogram from an existing Element. The method effectively just calls the ``histogram`` operation, which lets you compute a histogram from an Element, and then adjoins the resulting histogram. Here we will create two sets of ``Points``, compute a ``Histogram`` for the 'x' and 'y' dimension on each, which we then overlay and adjoin to the plot."
"The ``.hist`` method is an easy way to compute a histogram from an existing Element:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"points = hv.Points(np.random.randn(100,2))\n",
"\n",
"points.hist(dimension=['x','y'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``.hist`` method is just a convenient wrapper around the ``histogram`` operation that computes a histogram from an Element, and then adjoins the resulting histogram to the main plot. You can also do this process manually; here we create an additional set of ``Points``, compute a ``Histogram`` for the 'x' and 'y' dimension on each, and then overlay them and adjoin to the plot."
]
},
{
Expand All @@ -78,12 +96,12 @@
"source": [
"%%opts Histogram (alpha=0.3)\n",
"from holoviews.operation import histogram\n",
"points1 = hv.Points(np.random.randn(100,2)*2+1)\n",
"points2 = hv.Points(np.random.randn(100,2))\n",
"xhist, yhist = (histogram(points1, bin_range=(-5, 5), dimension=dim) *\n",
" histogram(points2, bin_range=(-5, 5), dimension=dim) \n",
"points2 = hv.Points(np.random.randn(100,2)*2+1)\n",
"\n",
"xhist, yhist = (histogram(points2, bin_range=(-5, 5), dimension=dim) *\n",
" histogram(points, bin_range=(-5, 5), dimension=dim) \n",
" for dim in 'xy')\n",
"(points1 * points2) << yhist(plot=dict(width=125)) << xhist(plot=dict(height=125))"
"(points2 * points) << yhist(plot=dict(width=125)) << xhist(plot=dict(height=125))"
]
}
],
Expand Down

0 comments on commit 02a82fa

Please sign in to comment.