Skip to content

Commit f913c3c

Browse files
authored
Tweak user guides (#1665)
* Explicitly loading 'matplotlib' for Continuous Coordinates * Added Tips and Tricks user guide
1 parent 22d1bdf commit f913c3c

2 files changed

Lines changed: 91 additions & 1 deletion

File tree

examples/user_guide/Continuous_Coordinates.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"source": [
3737
"import numpy as np\n",
3838
"import holoviews as hv\n",
39-
"hv.extension()\n",
39+
"hv.extension('matplotlib')\n",
4040
"\n",
4141
"np.set_printoptions(precision=2, linewidth=80)\n",
4242
"%opts HeatMap (cmap=\"hot\")"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Tips and Tricks"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"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)!"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": null,
20+
"metadata": {},
21+
"outputs": [],
22+
"source": [
23+
"import numpy as np\n",
24+
"import holoviews as hv\n",
25+
"hv.extension('bokeh')"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"metadata": {},
31+
"source": [
32+
"### Magics can be parameterized"
33+
]
34+
},
35+
{
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"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:"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": [
48+
"val = 0.25\n",
49+
"formatter = \"fig='html' filename='./curve_{suffix}'\" \n",
50+
"magic_line = formatter.format(suffix=val+0.25)"
51+
]
52+
},
53+
{
54+
"cell_type": "markdown",
55+
"metadata": {},
56+
"source": [
57+
"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``:"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {},
64+
"outputs": [],
65+
"source": [
66+
"%%output $magic_line\n",
67+
"val += 0.25\n",
68+
"magic_line = formatter.format(suffix=val+0.25)\n",
69+
"hv.Curve(([1,2,3],[1,2*val, 3]))"
70+
]
71+
},
72+
{
73+
"cell_type": "markdown",
74+
"metadata": {},
75+
"source": [
76+
"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",
77+
"\n",
78+
"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."
79+
]
80+
}
81+
],
82+
"metadata": {
83+
"language_info": {
84+
"name": "python",
85+
"pygments_lexer": "ipython3"
86+
}
87+
},
88+
"nbformat": 4,
89+
"nbformat_minor": 2
90+
}

0 commit comments

Comments
 (0)