Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new annotations, HSpan, VSpan #4000

Merged
merged 5 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions examples/reference/elements/bokeh/HLine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> HLine Element</dd>\n",
" <dt>Dependencies</dt> <dd>Bokeh</dd>\n",
" <dt>Backends</dt>\n",
" <dd><a href='./HLine.ipynb'>Bokeh</a></dd>\n",
" <dd><a href='../matplotlib/HLine.ipynb'>Matplotlib</a></dd>\n",
" <dd><a href='../plotly/HLine.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
"#### **Title**: HLine Element\n",
"\n",
"**Dependencies**: Bokeh\n",
"\n",
"**Backends**: [Matplotlib](../matplotlib/HLine.ipynb), [Bokeh](./HLine.ipynb)"
]
},
{
Expand Down Expand Up @@ -64,5 +59,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
83 changes: 83 additions & 0 deletions examples/reference/elements/bokeh/HSpan.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### **Title**: HSpan Element\n",
"\n",
"**Dependencies**: Bokeh\n",
"\n",
"**Backends**: [Matplotlib](../matplotlib/HSpan.ipynb), [Plotly](../plotly/HSpan.ipynb), [Bokeh](./HSpan.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"\n",
"hv.extension('bokeh')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``HSpan`` element is a type of annotation that marks a range along the y-axis. Here is an ``HSpan`` element that marks the standard deviation in a collection of points:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"xs = np.random.normal(size=500)\n",
"ys = np.random.normal(size=500) * xs\n",
"ymean, ystd = ys.mean(), ys.std()\n",
"\n",
"points = hv.Points((xs,ys))\n",
"hspan = hv.HSpan(ymean-ystd, ymean+ystd)\n",
"\n",
"hspan.opts(color='blue') * points.opts(color='#D3D3D3')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Like all annotation-like elements `HSpan` is not included in the calculation of axis ranges by default, but can be included by setting `apply_ranges=True`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"(hv.HSpan(1, 3) * hv.HSpan(5, 8)).opts(\n",
" opts.HSpan(apply_ranges=True))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.HSpan).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
17 changes: 6 additions & 11 deletions examples/reference/elements/bokeh/VLine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> VLine Element</dd>\n",
" <dt>Dependencies</dt> <dd>Bokeh</dd>\n",
" <dt>Backends</dt>\n",
" <dd><a href='./VLine.ipynb'>Bokeh</a></dd>\n",
" <dd><a href='../matplotlib/VLine.ipynb'>Matplotlib</a></dd>\n",
" <dd><a href='../plotly/VLine.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
"#### **Title**: VLine Element\n",
"\n",
"**Dependencies**: Bokeh\n",
"\n",
"**Backends**: [Matplotlib](../matplotlib/VLine.ipynb), [Bokeh](./VLine.ipynb)"
]
},
{
Expand Down Expand Up @@ -64,5 +59,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
82 changes: 82 additions & 0 deletions examples/reference/elements/bokeh/VSpan.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### **Title**: VSpan Element\n",
"\n",
"**Dependencies**: Bokeh\n",
"\n",
"**Backends**: [Matplotlib](../matplotlib/VSpan.ipynb), [Plotly](../plotly/VSpan.ipynb), [Bokeh](./VSpan.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"hv.extension('bokeh')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``VSpan`` element is a type of annotation that marks a range along the x-axis. Here is a ``VSpan`` marking maximum region of a quadratic curve:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"xs = np.linspace(-5, 5, 100)\n",
"ys = -(xs-2)**2\n",
"ymax = ys.argmax()\n",
"\n",
"curve = hv.Curve((xs,ys))\n",
"vspan = hv.VSpan(xs[ymax-5], xs[ymax+5])\n",
"\n",
"curve.opts(color='#D3D3D3') * vspan.opts(color='red')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Like all annotation-like elements `VSpan` is not included in the calculation of axis ranges by default, but can be included by setting `apply_ranges=True`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"(hv.VSpan(1, 3) * hv.VSpan(5, 8)).opts(\n",
" opts.VSpan(apply_ranges=True))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.VSpan).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
17 changes: 6 additions & 11 deletions examples/reference/elements/matplotlib/HLine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> HLine Element</dd>\n",
" <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
" <dt>Backends</dt>\n",
" <dd><a href='./HLine.ipynb'>Matplotlib</a></dd>\n",
" <dd><a href='../bokeh/HLine.ipynb'>Bokeh</a></dd>\n",
" <dd><a href='../plotly/HLine.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
"#### **Title**: HLine Element\n",
"\n",
"**Dependencies**: Matplotlib\n",
"\n",
"**Backends**: [Bokeh](../bokeh/HLine.ipynb), [Matplotlib](./HLine.ipynb)"
]
},
{
Expand Down Expand Up @@ -66,5 +61,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
83 changes: 83 additions & 0 deletions examples/reference/elements/matplotlib/HSpan.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### **Title**: HSpan Element\n",
"\n",
"**Dependencies**: Matplotlib\n",
"\n",
"**Backends**: [Bokeh](../bokeh/HSpan.ipynb), [Plotly](../plotly/HSpan.ipynb), [Matplotlib](./HSpan.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"\n",
"hv.extension('matplotlib')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ``HSpan`` element is a type of annotation that marks a range along the y-axis. Here is an ``HSpan`` element that marks the standard deviation in a collection of points:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"xs = np.random.normal(size=500)\n",
"ys = np.random.normal(size=500) * xs\n",
"ymean, ystd = ys.mean(), ys.std()\n",
"\n",
"points = hv.Points((xs,ys))\n",
"hspan = hv.HSpan(ymean-ystd, ymean+ystd)\n",
"\n",
"hspan.opts(facecolor='blue') * points.opts(color='#D3D3D3')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Like all annotation-like elements `HSpan` is not included in the calculation of axis ranges by default, but can be included by setting `apply_ranges=True`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"(hv.HSpan(1, 3) * hv.HSpan(5, 8)).opts(\n",
" opts.HSpan(apply_ranges=True))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.HSpan).``"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
17 changes: 6 additions & 11 deletions examples/reference/elements/matplotlib/VLine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> VLine Element</dd>\n",
" <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
" <dt>Backends</dt>\n",
" <dd><a href='./VLine.ipynb'>Matplotlib</a></dd>\n",
" <dd><a href='../bokeh/VLine.ipynb'>Bokeh</a></dd>\n",
" <dd><a href='../plotly/VLine.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
"#### **Title**: VLine Element\n",
"\n",
"**Dependencies**: Matplotlib\n",
"\n",
"**Backends**: [Bokeh](../bokeh/VLine.ipynb), [Matplotlib](./VLine.ipynb)"
]
},
{
Expand Down Expand Up @@ -66,5 +61,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading