From a11eda98dac1bea8dd0554d74821f07038cf8834 Mon Sep 17 00:00:00 2001 From: jlstevens Date: Sat, 1 Jul 2017 14:14:48 +0100 Subject: [PATCH 1/2] Explicitly loading 'matplotlib' for Continuous Coordinates --- examples/user_guide/Continuous_Coordinates.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/user_guide/Continuous_Coordinates.ipynb b/examples/user_guide/Continuous_Coordinates.ipynb index 71f4582dfd..0aa4602761 100644 --- a/examples/user_guide/Continuous_Coordinates.ipynb +++ b/examples/user_guide/Continuous_Coordinates.ipynb @@ -36,7 +36,7 @@ "source": [ "import numpy as np\n", "import holoviews as hv\n", - "hv.extension()\n", + "hv.extension('matplotlib')\n", "\n", "np.set_printoptions(precision=2, linewidth=80)\n", "%opts HeatMap (cmap=\"hot\")" From 6e0536dad7bb5c98afb4cba0fb7946a1805ba21f Mon Sep 17 00:00:00 2001 From: jlstevens Date: Sat, 1 Jul 2017 14:17:11 +0100 Subject: [PATCH 2/2] Added Tips and Tricks user guide --- examples/user_guide/Tips_and_Tricks.ipynb | 90 +++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 examples/user_guide/Tips_and_Tricks.ipynb diff --git a/examples/user_guide/Tips_and_Tricks.ipynb b/examples/user_guide/Tips_and_Tricks.ipynb new file mode 100644 index 0000000000..61ecfd5ba2 --- /dev/null +++ b/examples/user_guide/Tips_and_Tricks.ipynb @@ -0,0 +1,90 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Tips and Tricks" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This user guide contains an assorted collection of tips and tricks for minor features that don't have a suitable place in the rest of the documentation. Note that some of these tricks may be quick and convenient but not necessarily recommended practice. The list is currently quite short so if you have a neat tip to add to this guide, do suggest it to us on [gitter](https://gitter.im/ioam/holoviews)!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import holoviews as hv\n", + "hv.extension('bokeh')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Magics can be parameterized" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The IPython magic syntax can be parameterized by building a string and using the ``$`` symbol. The following example outputs a bunch of files with parameterized output and filenames:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "val = 0.25\n", + "formatter = \"fig='html' filename='./curve_{suffix}'\" \n", + "magic_line = formatter.format(suffix=val+0.25)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now you can repeatedly run the following cell to change ``val`` and the filename that the output is saved to. You can repeatedly run a cell in Jupyter notebook using ``Ctrl + Enter``:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%output $magic_line\n", + "val += 0.25\n", + "magic_line = formatter.format(suffix=val+0.25)\n", + "hv.Curve(([1,2,3],[1,2*val, 3]))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now ``curve_0.5.html`` and any subsequent files should have been output in the current directory. On Unix systems you can remove these files by running ``rm curve_*.html`` in a code cell.\n", + "\n", + "Note this is just a convenience! The robust and reproducible way to do this is to use an explicit renderer and loop as detailed in the [Plots and Renderers.ipynb](./Plots_and_Renderers.ipynb) user guide." + ] + } + ], + "metadata": { + "language_info": { + "name": "python", + "pygments_lexer": "ipython3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}