diff --git a/doc/Tutorials/Elements.ipynb b/doc/Tutorials/Elements.ipynb index 66f14e9995..cc736f0d1c 100644 --- a/doc/Tutorials/Elements.ipynb +++ b/doc/Tutorials/Elements.ipynb @@ -30,6 +30,7 @@ "
[``Spread``](#Spread)
Just like ErrorBars, Spread is a collection of x-/y-coordinates with associated symmetric or asymmetric errors.
\n", "
[``Bars``](#Bars)
Data collected and binned into categories.
\n", "
[``Histogram``](#Histogram)
Data collected and binned in a continuous space using specified bin edges.
\n", + "
[``BoxWhisker``](#BoxWhisker)
Distributions of data varying by 0-N key dimensions.
\n", "
[``Scatter``](#Scatter)
Discontinuous collection of points indexed over a single dimension.
\n", "
[``Points``](#Points)
Discontinuous collection of points indexed over two dimensions.
\n", "
[``VectorField``](#VectorField)
Cyclic variable (and optional auxiliary data) distributed over two-dimensional space.
\n", @@ -327,6 +328,71 @@ " kdims=['Group', 'Category', 'Stack'], vdims=['Count'])" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### ``BoxWhisker`` " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The ``BoxWhisker`` Element allows representing distribution of data varying by 0-N key dimensions. To represent the distribution of a single variable we can create a BoxWhisker Element with no key dimensions and a single value dimension:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "hv.BoxWhisker(np.random.randn(200), kdims=[], vdims=['Value'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By adding a key dimension we can compare multiple distributions. Since the variables are randomly assigned we sort the Element first." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "hv.BoxWhisker((np.random.randint(0, 10, 200), np.random.randn(200)),\n", + " kdims=['Variable'], vdims=['Value']).sort()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "BoxWhisker Elements support any number of dimensions and may also be inverted. To style the boxes and whiskers supply boxprops, whiskerprops and flierprops." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%opts BoxWhisker [fig_size=200 invert_axes=True] (boxprops=dict(color='gray') whiskerprops=dict(color='indianred'))\n", + "groups = [chr(65+g) for g in np.random.randint(0, 3, 200)]\n", + "hv.BoxWhisker((groups, np.random.randint(0, 5, 200), np.random.randn(200)),\n", + " kdims=['Group', 'Category'], vdims=['Value']).sort()" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1390,7 +1456,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.10" + "version": "2.7.11" } }, "nbformat": 4,