Skip to content

Commit

Permalink
Updated the QuadMesh notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens committed May 31, 2017
1 parent ab90b32 commit bd8a84c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
6 changes: 3 additions & 3 deletions examples/elements/bokeh/QuadMesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.notebook_extension('bokeh', 'matplotlib')"
"hv.notebook_extension('bokeh')"
]
},
{
Expand Down Expand Up @@ -118,9 +118,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:science]",
"display_name": "Python 2",
"language": "python",
"name": "conda-env-science-py"
"name": "python2"
},
"language_info": {
"codemirror_mode": {
Expand Down
32 changes: 6 additions & 26 deletions examples/elements/matplotlib/QuadMesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.notebook_extension('bokeh', 'matplotlib')"
"hv.notebook_extension()"
]
},
{
Expand Down Expand Up @@ -52,7 +52,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The coordinate system of a ``QuadMesh`` is defined by the bin edges, therefore any index falling into a binned region will return the appropriate value. ``QuadMesh`` supports inspection of values using the Bokeh hover tools and because the bin edges have continuous values, you can use non-linear axes such as log axes:"
"The coordinate system of a ``QuadMesh`` is defined by the bin edges, therefore any index falling into a binned region will return the appropriate value. As the bin edges have continuous values, you can use non-linear axes such as log axes:"
]
},
{
Expand All @@ -63,7 +63,7 @@
},
"outputs": [],
"source": [
"%%opts QuadMesh [tools=['hover'] xticks=[10, 100,1000]] QuadMesh.LogScale [logx=True]\n",
"%%opts QuadMesh [xticks=[10, 100,1000]] QuadMesh.LogScale [logx=True]\n",
"hv.QuadMesh((xs, ys, zs), group='LinearScale') + hv.QuadMesh((xs, ys, zs), group='LogScale')"
]
},
Expand Down Expand Up @@ -92,35 +92,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As ``QuadMesh`` supports the Bokeh hover tool while ``Image`` does not, we can get use a simple trick to enable hover information: overlay the image with an invisible ``QuadMesh`` cast from the same image. We can set the ``QuadMesh`` alpha to zero while keeping an opaque hover line color:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%%opts QuadMesh [tools=['hover']] (alpha=0 hover_line_alpha=1 hover_line_color='black')\n",
"img = hv.Image(np.random.rand(10,10))\n",
"img * hv.QuadMesh(img)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now when you hover over this visualization, you can see the sample value as well as an outline of the selected bin."
"To use an interactive hover tool to inspect the sample values, you can use ``QuadMesh`` with the hover tool in the [Bokeh backend](../bokeh/QuadMesh.ipynb)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:science]",
"display_name": "Python 2",
"language": "python",
"name": "conda-env-science-py"
"name": "python2"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit bd8a84c

Please sign in to comment.