# coding: utf-8 # # Tips and Tricks # 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)! # In[ ]: import holoviews as hv hv.extension('bokeh') # ### Magics can be parameterized # 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: # In[ ]: val = 0.25 formatter = "fig='html' filename='./curve_{suffix}'" magic_line = formatter.format(suffix=val+0.25) # 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``: # In[ ]: get_ipython().run_cell_magic('output', '$magic_line', 'val += 0.25\nmagic_line = formatter.format(suffix=val+0.25)\nhv.Curve(([1,2,3],[1,2*val, 3]))') # 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. # # 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.