"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.extension('plotly')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A ``Distribution`` Element is a quick way of visualize the distribution of some data visualizing it as a a histogram or kernel density estimate. Unlike the ``Histogram`` Element ``Distribution`` wraps the raw data rather than representing the already binned data.\n",
"\n",
"Here we will wrap a simple numpy array containing 1000 samples of a normal distribution."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hv.Distribution(np.random.randn(1000))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"``Distribution`` Elements like all other Elements can be overlaid allowing us to compare two distributions:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hv.Distribution(np.random.randn(1000), label='#1') * hv.Distribution(np.random.randn(1000)+2, label='#2')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Distribution).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 1
}