Skip to content

Commit

Permalink
Updated Spikes examples in notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 11, 2015
1 parent 4345ea1 commit 1c047bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions doc/Tutorials/Elements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
},
"outputs": [],
"source": [
"%%opts Spikes [spike_height=0.1] (alpha=0.4)\n",
"%%opts Spikes (alpha=0.4)\n",
"xs = np.random.rand(50)\n",
"ys = np.random.rand(50)\n",
"hv.Points((xs, ys)) * hv.Spikes(xs)"
Expand All @@ -507,15 +507,15 @@
},
"outputs": [],
"source": [
"%%opts Spikes (cmap='Blues')\n",
"%%opts Spikes (cmap='Reds')\n",
"hv.Spikes(np.random.rand(20, 2), kdims=['Mass'], vdims=['Intensity'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Another possibility is to draw a number of spike trains as you would encounter in neuroscience:"
"Another possibility is to draw a number of spike trains as you would encounter in neuroscience. Here we generate 10 separate random spike trains and distribute them evenly across the space by setting their ``position``. By also declaring some yticks each spike traing can be labeled individually:"
]
},
{
Expand All @@ -526,16 +526,16 @@
},
"outputs": [],
"source": [
"%%opts Spikes [spike_height=0.1] NdOverlay [show_legend=False]\n",
"hv.NdOverlay({i: hv.Spikes(np.random.rand(10, 1))(plot=dict(yposition=0.1*i))\n",
" for i in range(10)})(plot=dict(yticks=[((i+1)*0.1-0.05, i)for i in range(10)]))"
"%%opts Spikes NdOverlay [show_legend=False]\n",
"hv.NdOverlay({i: hv.Spikes(np.random.randint(0, 100, 10), kdims=['Time'])(plot=dict(position=0.1*i))\n",
" for i in range(10)})(plot=dict(yticks=[((i+1)*0.1-0.05, i) for i in range(10)]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally we may use ``Spikes`` to adjoin to a regular plot to visualize marginal distributions:"
"Finally we may use ``Spikes`` to visualize marginal distributions as adjoined plots:"
]
},
{
Expand All @@ -546,8 +546,8 @@
},
"outputs": [],
"source": [
"%%opts Spikes (alpha=0.4) [bgcolor='w'] AdjointLayout [border_size=0]\n",
"points = hv.Points(np.random.randn(100, 2))\n",
"%%opts Spikes (alpha=0.05) [spike_length=0.5] AdjointLayout [border_size=0]\n",
"points = hv.Points(np.random.randn(500, 2))\n",
"points << hv.Spikes(points['y']) << hv.Spikes(points['x'])"
]
},
Expand Down

0 comments on commit 1c047bb

Please sign in to comment.