Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak user guides #1665

Merged
merged 2 commits into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/user_guide/Continuous_Coordinates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
Expand Down
90 changes: 90 additions & 0 deletions examples/user_guide/Tips_and_Tricks.ipynb
Original file line number Diff line number Diff line change
@@ -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
}