Skip to content

Commit

Permalink
Small notebook fixes (#2198)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 9, 2018
1 parent db20b0e commit ee01893
Show file tree
Hide file tree
Showing 85 changed files with 544 additions and 88 deletions.
2 changes: 1 addition & 1 deletion examples/gallery/demos/matplotlib/stocks_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"\n",
"def get_curve(data, label=''):\n",
" df = pd.DataFrame(data)\n",
" df['date'] = df.date.astype(np.datetime64)\n",
" df['date'] = df.date.astype('datetime64[ns]')\n",
" return hv.Curve(df, ('date', 'Date'), ('adj_close', 'Price'), label=label)\n",
"\n",
"hv.Dimension.type_formatters[np.datetime64] = '%Y'\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/getting_started/3-Tabular_Datasets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Bars [width=800 height=400 tools=['hover'] group_index=1 legend_position='top_left']\n",
"%%opts Bars [width=800 height=400 tools=['hover'] xrotation=90 show_legend=False]\n",
"states = ['New York', 'New Jersey', 'California', 'Texas']\n",
"ds.select(State=states, Year=(1980, 1990)).to(hv.Bars, ['Year', 'State'], 'measles').sort()"
]
Expand Down Expand Up @@ -201,7 +201,7 @@
"source": [
"%%opts Curve [width=600]\n",
"agg = ds.aggregate('Year', function=np.mean, spreadfn=np.std)\n",
"(hv.Curve(agg) * hv.ErrorBars(agg,vdims=['measles', 'measles_std'])).redim.range(measles=(0, None))"
"(hv.Curve(agg) * hv.ErrorBars(agg,vdims=['measles', 'measles_std']).iloc[::2]).redim.range(measles=(0, None))"
]
},
{
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Area.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
"overlay = hv.Overlay([hv.Area(percentages[:, i], vdims=[hv.Dimension('value', unit='%')]) for i in range(5)])\n",
"overlay + hv.Area.stack(overlay)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Area).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Arrow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
"(points * hv.Arrow(2, points['y'].min(), 'Min', 'v', arrowstyle='-[') *\n",
"hv.Arrow(2, points['y'].max(), 'Max', '^', arrowstyle='-[')).redim.range(y=(-5, 5), x=(-3, 3))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Arrow).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Bars.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
" ['Index', 'Group'], 'Count')\n",
"bars.relabel(group='Grouped') + bars.relabel(group='Stacked')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Bars).``"
]
}
],
"metadata": {
Expand Down
22 changes: 8 additions & 14 deletions examples/reference/elements/bokeh/Bivariate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,19 @@
"kde = bivariate_kde(dist, x_range=(-4, 4), y_range=(-4, 4), bw_method='silverman', n_samples=20)\n",
"kde"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Bivariate).``"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Bounds.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
"source": [
"penguins * penguins[-0.15:0.2, -0.4:0, 'G'] * hv.Bounds((-0.15, -0.4, 0.2, 0))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Bounds).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Box.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
"data[np.arange(30, 70), np.arange(30, 70)] = -3\n",
"hv.Image(data) * hv.Box(-0, 0, 0.25, aspect=3, orientation=-np.pi/4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Box).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/BoxWhisker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
"hv.BoxWhisker((groups, np.random.randint(0, 5, 200), np.random.randn(200)),\n",
" ['Group', 'Category'], 'Value').sort()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.BoxWhisker).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Contours.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
"img = hv.Image(np.sin(x**2+y**3))\n",
"img + hv.operation.contours(img, levels=5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Contours).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Curve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
"hv.NdOverlay({interp: hv.Curve(points[::8]).opts(plot=dict(interpolation=interp))\n",
" for interp in ['linear', 'steps-mid', 'steps-pre', 'steps-post']})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Curve).``"
]
}
],
"metadata": {
Expand Down
22 changes: 8 additions & 14 deletions examples/reference/elements/bokeh/Distribution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,19 @@
"kde = univariate_kde(dist, bin_range=(-4, 4), bw_method='silverman', n_samples=20)\n",
"kde"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Distribution).``"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Ellipse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
"clusters = hv.Points(c1) * hv.Points((c2x, c2y)) * hv.Points(c3)\n",
"clusters * hv.Ellipse(0,0, 4, orientation=np.pi/5, aspect=2) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Ellipse).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/ErrorBars.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
"errors = [(0.1*i, np.sin(0.1*i), np.random.rand()/2, np.random.rand()/4) for i in np.linspace(0, 100, 11)]\n",
"hv.Curve(errors) * hv.ErrorBars(errors, vdims=['y', 'yerrneg', 'yerrpos'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.ErrorBars).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@
"graph.redim.range(**padding).opts(plot=dict(color_index='Type', edge_color_index='Weight'),\n",
" style=dict(cmap=['blue', 'red'], edge_cmap='viridis'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Graph).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/HLine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
"ys = np.random.normal(size=100) * xs\n",
"hv.Points((xs,ys)) * hv.HLine(ys.mean())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.HLine).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/HSV.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
"print(hsv.rgb)\n",
"hsv.rgb[..., 'R'] + hsv.rgb[..., 'G'] + hsv.rgb[..., 'B']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.HSV).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/HeatMap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@
"hv.HeatMap((np.random.randint(0, 10, 100), np.random.randint(0, 10, 100),\n",
" np.random.randn(100), np.random.randn(100)), vdims=['z', 'z2']).redim.range(z=(-2, 2))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.HeatMap).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
" for dim in 'xy')\n",
"(points2 * points) << yhist(plot=dict(width=125)) << xhist(plot=dict(height=125))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Histogram).``"
]
}
],
"metadata": {
Expand Down
4 changes: 3 additions & 1 deletion examples/reference/elements/bokeh/Image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One additional way to create Image objects is via the separate [ImaGen](http://ioam.github.io/imagen) library, which creates parameterized streams of images for experiments, simulations, or machine-learning applications."
"One additional way to create Image objects is via the separate [ImaGen](http://ioam.github.io/imagen) library, which creates parameterized streams of images for experiments, simulations, or machine-learning applications.\n",
"\n",
"For full documentation and the available style and plot options, use ``hv.help(hv.Image).``"
]
}
],
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/ItemTable.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
"%%opts ItemTable [height=60]\n",
"hv.ItemTable([('Age', 10), ('Weight',15), ('Height','0.8 meters')])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.ItemTable).``"
]
}
],
"metadata": {
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Path.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@
"hv.Path((np.arange(N), np.random.rand(N, NLINES) + np.arange(NLINES)[np.newaxis, :])) *\\\n",
"hv.Path((np.arange(N), np.random.rand(N, NLINES) + np.arange(NLINES)[np.newaxis, :]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Path).``"
]
}
],
"metadata": {
Expand Down
5 changes: 4 additions & 1 deletion examples/reference/elements/bokeh/Points.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
"source": [
"**Note**: Although the ``Scatter`` element is superficially similar to the [``Points``](./Points.ipynb) element (they can generate plots that look identical), the two element types are semantically quite different. The fundamental difference is that [``Points``](./Points.ipynb) are used to visualize data where the *y* variable is *dependent*. This semantic difference also explains why the histogram generated by ``hist`` call above visualizes the distribution of a different dimension than it does for [``Scatter``](./Scatter.ipynb).\n",
"\n",
"This difference means that ``Points`` naturally combine elements that express independent variables in two-dimensional space, for instance [``Raster``](./Raster.ipynb) types such as [``Image``](./Image.ipynb). Similarly, ``Scatter`` expresses a dependent relationship in two-dimensions and combine naturally with ``Chart`` types such as [``Curve``](./Curve.ipynb)."
"This difference means that ``Points`` naturally combine elements that express independent variables in two-dimensional space, for instance [``Raster``](./Raster.ipynb) types such as [``Image``](./Image.ipynb). Similarly, ``Scatter`` expresses a dependent relationship in two-dimensions and combine naturally with ``Chart`` types such as [``Curve``](./Curve.ipynb).\n",
"\n",
"\n",
"For full documentation and the available style and plot options, use ``hv.help(hv.Points).``"
]
}
],
Expand Down
7 changes: 7 additions & 0 deletions examples/reference/elements/bokeh/Polygons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"hv.Polygons([{('x', 'y'): hv.Box(0, 0, i).array(), 'z': i} for i in range(1, 10)[::-1]], vdims='z') +\\\n",
"hv.Polygons([{('x', 'y'): hv.Ellipse(0, 0, (i, i)).array(), 'z': i} for i in range(1, 10)[::-1]], vdims='z')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For full documentation and the available style and plot options, use ``hv.help(hv.Polygons).``"
]
}
],
"metadata": {
Expand Down
4 changes: 3 additions & 1 deletion examples/reference/elements/bokeh/QuadMesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
"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."
"Now when you hover over this visualization, you can see the sample value as well as an outline of the selected bin.\n",
"\n",
"For full documentation and the available style and plot options, use ``hv.help(hv.QuadMesh).``"
]
}
],
Expand Down
4 changes: 3 additions & 1 deletion examples/reference/elements/bokeh/RGB.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One additional way to create RGB objects is via the separate [ImaGen](http://ioam.github.io/imagen) library, which creates parameterized streams of images for experiments, simulations, or machine-learning applications."
"One additional way to create RGB objects is via the separate [ImaGen](http://ioam.github.io/imagen) library, which creates parameterized streams of images for experiments, simulations, or machine-learning applications.\n",
"\n",
"For full documentation and the available style and plot options, use ``hv.help(hv.RGB).``"
]
}
],
Expand Down
Loading

0 comments on commit ee01893

Please sign in to comment.