{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# An introduction to the Jupyther Notebook (formerly known as IPython notebook)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import addutils.toc ; addutils.toc.js(ipy_notebook=True)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from addutils import css_notebook\n", "css_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1 Before starting..." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include:\n", "\n", "* Live code\n", "* Interactive widgets\n", "* Plots\n", "* Narrative text\n", "* Equations\n", "* Images\n", "* Video\n", "\n", "These documents provide a complete and self-contained record of a computation that can be converted to various formats and shared with others using email, [Dropbox](http://dropbox.com), version control systems (like git/[GitHub](http://github.com)) or [nbviewer.jupyter.org](http://nbviewer.jupyter.org).\n", "\n", "To find more documentation and examples check the follwing links:\n", "\n", "* [Jupyter Project page](http://jupyter.org/)\n", "* [Jupyther Documentation](http://jupyter.readthedocs.org/en/latest/)\n", "* [Notebook Gallery](http://nb.bianp.net/sort/views/)\n", "\n", "The document you are reading now is precisely an example of one such notebook, and we will show you here how to best use this new interface. The first thing to understand is that a notebook consists of a sequence of 'cells' that can contain either text or code meant for execution:\n", "\n", "* Text cells can be written using [Markdown syntax](http://daringfireball.net/projects/markdown/syntax) (in a future release there will be support for reStructuredText and Sphinx integration).\n", "* Code cells take IPython input (i.e. Python code, `%magics, !system calls`, etc). When you type `Shift-Enter`, the cell content is executed, output displayed and a new cell is created below. **Try it now** by putting your cursor on the next cell and typing `Shift-Enter`:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This is the new IPython notebook\n" ] } ], "source": [ "print ('This is the new IPython notebook')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*You can re-execute the same cell over and over as many times as you want.* Simply put your\n", "cursor in the cell again, edit at will, and type `Shift-Enter` to execute. \n", "\n", "**Tip:** A cell can also be executed\n", "*in-place*, where IPython executes its content but leaves the cursor in the same cell. This is done by\n", "typing `Ctrl-Enter` instead, and is useful if you want to quickly run a command to check something \n", "before typing the real content you want to leave in the cell. For example, in the next cell, try issuing\n", "several system commands in-place with `Ctrl-Enter`, such as `pwd` and then `ls`:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/home/matteo/Projects/tutorials/python-ipython'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pwd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In a cell, you can type anything from a single python expression to an arbitrarily long amount of code \n", "(although for reasons of readability, you should probably limit this to a few dozen lines):" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "f(3.00)= 3.00\n" ] } ], "source": [ "def f(x):\n", " '''My function description'''\n", " return x+6\n", "\n", "value = 3\n", "print ('f({0:.2f})= {0:.2f}'.format(value, f(value)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.1 Kernels" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Notebook allows code to be run in a range of different programming languages. For each notebook document that a user opens, the web application starts a kernel that runs the code for that notebook. Each kernel is capable of running code in a single programming language and there are kernels available in the following languages:\n", "\n", "* Python(https://github.com/ipython/ipython)\n", "* Julia (https://github.com/JuliaLang/IJulia.jl)\n", "* R (https://github.com/takluyver/IRkernel)\n", "* Ruby (https://github.com/minrk/iruby)\n", "* Haskell (https://github.com/gibiansky/IHaskell)\n", "* Scala (https://github.com/Bridgewater/scala-notebook)\n", "* node.js (https://gist.github.com/Carreau/4279371)\n", "* Go (https://github.com/takluyver/igo)\n", "\n", "The default kernel runs Python code. The notebook provides a simple way for users to pick which of these kernels is used for a given notebook.\n", "\n", "Each of these kernels communicate with the notebook web application and web browser using a JSON over ZeroMQ/WebSockets message protocol." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2 User interface" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When you start a new notebook server with `ipython notebook`, your\n", "browser should open into the *Dashboard*, a page listing all notebooks\n", "available in the current directory, which allow to create new\n", "notebooks. In this page, you can also drag and drop existing `.py` files\n", "over the file list to import them as notebooks (see the manual for \n", "[further details on how these files are \n", "interpreted](http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html)).\n", "\n", "Once you open an existing notebook (like this one) or create a new one,\n", "you are in the main notebook interface, which consists of a main editing\n", "area (where these cells are contained) as well as a menu and \n", "permanent header area at the top, and a pager that rises from the\n", "bottom when needed and can be collapsed again." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.1 Main editing area" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here, you can move with the arrow keys or use the \n", "scroll bars. The cursor enters code cells immediately, but only selects\n", "text (markdown) cells without entering them; to enter a text cell,\n", "use `Enter` (or double-click), and `Shift-Enter` to exit it again (just like executing a \n", "code cell)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.2 Menu" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The menu bar contains all the commands you can use to manipulate the notebook.\n", "\n", "* The ***File*** menu has the usual open/save file operations, as well as Export, for downloading the notebook to your computer.\n", "* ***Edit*** has controls for cut/copy/paste.\n", "* ***View*** lets you toggle visibility of the header elements.\n", "* The ***Cell*** menu lets you manipulate individual cells.\n", "* The ***Kernel*** menu lets you signal the kernel executing your code. \n", "`Interrupt` stops the running computation while\n", "`Restart` fully kills the kernel and starts a fresh one. Obviously this means that all your previous variables are destroyed, but it also makes it easy to get a fresh kernel in which to re-execute a notebook, perhaps after changing an extension module for which Python's `reload` mechanism does not work.\n", "* The ***Help*** menu contains links to the documentation of some projects closely related to IPython as well as the minimal keybindings you need to know. You should use `Ctrl-m h` (or click the `QuickHelp` button at\n", "the top) to show keybindings.\n", "* You will also see a ***few buttons*** there for common actions, and hovering over each button will tell you which command they correspond to, if the icons are not clear enough." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.3 Help and Keyboard Shortcuts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Go to **Help -> Keyboard Shortcuts** to see the complete shortcuts list" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To access the help system symply type `help()` in a code cell. Use `quit` to finish:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Welcome to Python 3.6's help utility!\n", "\n", "If this is your first time using Python, you should definitely check out\n", "the tutorial on the Internet at http://docs.python.org/3.6/tutorial/.\n", "\n", "Enter the name of any module, keyword, or topic to get help on writing\n", "Python programs and using Python modules. To quit this help utility and\n", "return to the interpreter, just type \"quit\".\n", "\n", "To get a list of available modules, keywords, symbols, or topics, type\n", "\"modules\", \"keywords\", \"symbols\", or \"topics\". Each module also comes\n", "with a one-line summary of what it does; to list the modules whose name\n", "or summary contain a given string such as \"spam\", type \"modules spam\".\n", "\n", "help> \n", "\n", "You are now leaving help and returning to the Python interpreter.\n", "If you want to ask for help on a particular object directly from the\n", "interpreter, you can type \"help(object)\". Executing \"help('string')\"\n", "has the same effect as typing a particular string at the help> prompt.\n" ] } ], "source": [ "help()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.4 Header bar" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The header area at the top allows you to rename an existing notebook. This area also indicates whenever the kernel is busy executing code." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.5 The pager at the bottom" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Whenever IPython needs to display additional information, such as when you type `somefunction?` in a cell, the notebook\n", "opens a pane at the bottom. You can keep this pager pane open for reference (it doesn't block input in the main area) or dismiss it by clicking on its divider bar. Try this:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "print??" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3 Tab completion and tooltips" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Whey you complete with the `Tab` key, IPython shows a drop list with all available completions. If you type more characters while this list is open, IPython automatically refines the search; once there is only one option left you can hit `Tab` once more (or `Enter`) to complete. You can also select the completion you want with the arrow keys or the mouse, and then hit `Enter`.\n", "\n", "In addition, if you hit `Tab` inside of open parentheses, IPython will search for the docstring of the last object left of the parens and will display it on a tooltip. For example, type `list(` and you will see the docstring for the builtin `list` constructor. Moreover, pressing tab several time in a row allows you change the behaviour of the tooltip:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# Remove comment, then position your cursor after the ( and hit the Tab key:\n", "#list(" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4 Plotting support" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can enable inline plotting with `%pylab inline`:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " Loading BokehJS ...\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function(root) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " var force = true;\n", "\n", " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n", " root._bokeh_onload_callbacks = [];\n", " root._bokeh_is_loading = undefined;\n", " }\n", "\n", " var JS_MIME_TYPE = 'application/javascript';\n", " var HTML_MIME_TYPE = 'text/html';\n", " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n", " var CLASS_NAME = 'output_bokeh rendered_html';\n", "\n", " /**\n", " * Render data to the DOM node\n", " */\n", " function render(props, node) {\n", " var script = document.createElement(\"script\");\n", " node.appendChild(script);\n", " }\n", "\n", " /**\n", " * Handle when an output is cleared or removed\n", " */\n", " function handleClearOutput(event, handle) {\n", " var cell = handle.cell;\n", "\n", " var id = cell.output_area._bokeh_element_id;\n", " var server_id = cell.output_area._bokeh_server_id;\n", " // Clean up Bokeh references\n", " if (id !== undefined) {\n", " Bokeh.index[id].model.document.clear();\n", " delete Bokeh.index[id];\n", " }\n", "\n", " if (server_id !== undefined) {\n", " // Clean up Bokeh references\n", " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n", " cell.notebook.kernel.execute(cmd, {\n", " iopub: {\n", " output: function(msg) {\n", " var element_id = msg.content.text.trim();\n", " Bokeh.index[element_id].model.document.clear();\n", " delete Bokeh.index[element_id];\n", " }\n", " }\n", " });\n", " // Destroy server and session\n", " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n", " cell.notebook.kernel.execute(cmd);\n", " }\n", " }\n", "\n", " /**\n", " * Handle when a new output is added\n", " */\n", " function handleAddOutput(event, handle) {\n", " var output_area = handle.output_area;\n", " var output = handle.output;\n", "\n", " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n", " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n", " return\n", " }\n", "\n", " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", "\n", " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n", " toinsert[0].firstChild.textContent = output.data[JS_MIME_TYPE];\n", " // store reference to embed id on output_area\n", " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", " }\n", " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", " var bk_div = document.createElement(\"div\");\n", " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", " var script_attrs = bk_div.children[0].attributes;\n", " for (var i = 0; i < script_attrs.length; i++) {\n", " toinsert[0].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n", " }\n", " // store reference to server id on output_area\n", " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", " }\n", " }\n", "\n", " function register_renderer(events, OutputArea) {\n", "\n", " function append_mime(data, metadata, element) {\n", " // create a DOM node to render to\n", " var toinsert = this.create_output_subarea(\n", " metadata,\n", " CLASS_NAME,\n", " EXEC_MIME_TYPE\n", " );\n", " this.keyboard_manager.register_events(toinsert);\n", " // Render to node\n", " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", " render(props, toinsert[0]);\n", " element.append(toinsert);\n", " return toinsert\n", " }\n", "\n", " /* Handle when an output is cleared or removed */\n", " events.on('clear_output.CodeCell', handleClearOutput);\n", " events.on('delete.Cell', handleClearOutput);\n", "\n", " /* Handle when a new output is added */\n", " events.on('output_added.OutputArea', handleAddOutput);\n", "\n", " /**\n", " * Register the mime type and append_mime function with output_area\n", " */\n", " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", " /* Is output safe? */\n", " safe: true,\n", " /* Index of renderer in `output_area.display_order` */\n", " index: 0\n", " });\n", " }\n", "\n", " // register the mime type if in Jupyter Notebook environment and previously unregistered\n", " if (root.Jupyter !== undefined) {\n", " var events = require('base/js/events');\n", " var OutputArea = require('notebook/js/outputarea').OutputArea;\n", "\n", " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", " register_renderer(events, OutputArea);\n", " }\n", " }\n", "\n", " \n", " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", " root._bokeh_timeout = Date.now() + 5000;\n", " root._bokeh_failed_load = false;\n", " }\n", "\n", " var NB_LOAD_WARNING = {'data': {'text/html':\n", " \"
\\n\"+\n", " \"

\\n\"+\n", " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", " \"

\\n\"+\n", " \"
    \\n\"+\n", " \"
  • re-rerun `output_notebook()` to attempt to load from CDN again, or
  • \\n\"+\n", " \"
  • use INLINE resources instead, as so:
  • \\n\"+\n", " \"
\\n\"+\n", " \"\\n\"+\n", " \"from bokeh.resources import INLINE\\n\"+\n", " \"output_notebook(resources=INLINE)\\n\"+\n", " \"\\n\"+\n", " \"
\"}};\n", "\n", " function display_loaded() {\n", " var el = document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\");\n", " if (el != null) {\n", " el.textContent = \"BokehJS is loading...\";\n", " }\n", " if (root.Bokeh !== undefined) {\n", " if (el != null) {\n", " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n", " }\n", " } else if (Date.now() < root._bokeh_timeout) {\n", " setTimeout(display_loaded, 100)\n", " }\n", " }\n", "\n", "\n", " function run_callbacks() {\n", " try {\n", " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n", " }\n", " finally {\n", " delete root._bokeh_onload_callbacks\n", " }\n", " console.info(\"Bokeh: all callbacks have finished\");\n", " }\n", "\n", " function load_libs(js_urls, callback) {\n", " root._bokeh_onload_callbacks.push(callback);\n", " if (root._bokeh_is_loading > 0) {\n", " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", " return null;\n", " }\n", " if (js_urls == null || js_urls.length === 0) {\n", " run_callbacks();\n", " return null;\n", " }\n", " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", " root._bokeh_is_loading = js_urls.length;\n", " for (var i = 0; i < js_urls.length; i++) {\n", " var url = js_urls[i];\n", " var s = document.createElement('script');\n", " s.src = url;\n", " s.async = false;\n", " s.onreadystatechange = s.onload = function() {\n", " root._bokeh_is_loading--;\n", " if (root._bokeh_is_loading === 0) {\n", " console.log(\"Bokeh: all BokehJS libraries loaded\");\n", " run_callbacks()\n", " }\n", " };\n", " s.onerror = function() {\n", " console.warn(\"failed to load library \" + url);\n", " };\n", " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", " document.getElementsByTagName(\"head\")[0].appendChild(s);\n", " }\n", " };var element = document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\");\n", " if (element == null) {\n", " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '19e4f1f2-ef42-408e-aaed-d44ddb62d798' but no matching script tag was found. \")\n", " return false;\n", " }\n", "\n", " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.13.min.js\"];\n", "\n", " var inline_js = [\n", " function(Bokeh) {\n", " Bokeh.set_log_level(\"info\");\n", " },\n", " \n", " function(Bokeh) {\n", " \n", " },\n", " function(Bokeh) {\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.css\");\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.css\");\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.css\");\n", " }\n", " ];\n", "\n", " function run_inline_js() {\n", " \n", " if ((root.Bokeh !== undefined) || (force === true)) {\n", " for (var i = 0; i < inline_js.length; i++) {\n", " inline_js[i].call(root, root.Bokeh);\n", " }if (force === true) {\n", " display_loaded();\n", " }} else if (Date.now() < root._bokeh_timeout) {\n", " setTimeout(run_inline_js, 100);\n", " } else if (!root._bokeh_failed_load) {\n", " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", " root._bokeh_failed_load = true;\n", " } else if (force !== true) {\n", " var cell = $(document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\")).parents('.cell').data().cell;\n", " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n", " }\n", "\n", " }\n", "\n", " if (root._bokeh_is_loading === 0) {\n", " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", " run_inline_js();\n", " } else {\n", " load_libs(js_urls, function() {\n", " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n", " run_inline_js();\n", " });\n", " }\n", "}(window));" ], "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"
    \\n\"+\n \"
  • re-rerun `output_notebook()` to attempt to load from CDN again, or
  • \\n\"+\n \"
  • use INLINE resources instead, as so:
  • \\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '19e4f1f2-ef42-408e-aaed-d44ddb62d798' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.13.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.13.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.13.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.13.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"19e4f1f2-ef42-408e-aaed-d44ddb62d798\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import bokeh.plotting as bk\n", "bk.output_notebook()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " var docs_json = {\"47b29999-a5e7-4ecc-bc06-8b3e16ac1a31\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data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478NkH7yLS7Zv1KgOPj2XMO/HnSEjV/RuT8cql9WpzPWP7/bJlelRuI/CKj2MxlK6D8=\",\"dtype\":\"float64\",\"shape\":[700]}}},\"id\":\"af45adba-8cdc-42bf-ba5e-2d90a2449251\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"magenta\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2109d04f-1241-46dc-928d-999cf40de841\",\"type\":\"Line\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"f3ea42a5-18cd-4ce8-90b5-b9dba9629774\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"913b5c9a-495c-4d1c-833b-e3e72d7d63c6\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":null,\"text\":\"A simple Chirp\",\"text_font_size\":{\"value\":\"18pt\"}},\"id\":\"94109c38-6364-42af-815a-de0fad662c12\",\"type\":\"Title\"},{\"attributes\":{\"source\":{\"id\":\"af45adba-8cdc-42bf-ba5e-2d90a2449251\",\"type\":\"ColumnDataSource\"}},\"id\":\"88c01b6c-95b6-4c54-a375-3b0e8a5da359\",\"type\":\"CDSView\"},{\"attributes\":{\"callback\":null},\"id\":\"f4ca60d9-5719-44c0-8098-070f02f1fb52\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"b7421ba0-b454-4e47-8ed2-1cf92cef5d8f\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"017846b5-4a4a-45d9-915a-823eac0acdbe\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"38639514-4a04-4775-affb-bb8ae557c7d8\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c7b76ed7-2541-4555-a7ca-d8db8f5f0b4c\",\"type\":\"Line\"},{\"attributes\":{\"formatter\":{\"id\":\"3ab261bd-33a2-4fc8-9509-278240a5ab67\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1603bc4b-c829-4897-806b-558f5ff17cb1\",\"type\":\"BasicTicker\"}},\"id\":\"6437be4c-7a5b-43ed-8fcf-d8344c3e6517\",\"type\":\"LinearAxis\"},{\"attributes\":{\"overlay\":{\"id\":\"f3ea42a5-18cd-4ce8-90b5-b9dba9629774\",\"type\":\"BoxAnnotation\"}},\"id\":\"e983bc5a-45cf-4931-9585-1463f551d476\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"af45adba-8cdc-42bf-ba5e-2d90a2449251\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2109d04f-1241-46dc-928d-999cf40de841\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"c7b76ed7-2541-4555-a7ca-d8db8f5f0b4c\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"88c01b6c-95b6-4c54-a375-3b0e8a5da359\",\"type\":\"CDSView\"}},\"id\":\"d77fcda3-5f9c-4a8b-9ba7-5419895529c5\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"ac6e4b05-8b21-4ca4-98be-e5a5fd682907\",\"type\":\"SaveTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"913b5c9a-495c-4d1c-833b-e3e72d7d63c6\",\"type\":\"PanTool\"},{\"id\":\"b7421ba0-b454-4e47-8ed2-1cf92cef5d8f\",\"type\":\"WheelZoomTool\"},{\"id\":\"e983bc5a-45cf-4931-9585-1463f551d476\",\"type\":\"BoxZoomTool\"},{\"id\":\"ac6e4b05-8b21-4ca4-98be-e5a5fd682907\",\"type\":\"SaveTool\"},{\"id\":\"e5700ed0-2f6f-41da-aa4f-3355d3176907\",\"type\":\"ResetTool\"},{\"id\":\"c7d35a5d-7a19-41d2-b22d-e85dc235f619\",\"type\":\"HelpTool\"}]},\"id\":\"56eedf3a-6441-4c12-bbf8-08e34dfda225\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"3ab261bd-33a2-4fc8-9509-278240a5ab67\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"e5700ed0-2f6f-41da-aa4f-3355d3176907\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null},\"id\":\"def48a5e-ccd0-44ca-a4c4-04ed07ee2e3f\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"c7d35a5d-7a19-41d2-b22d-e85dc235f619\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"bf7fc4ef-b643-4d93-b3a6-bb2ff800d9a9\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1603bc4b-c829-4897-806b-558f5ff17cb1\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":{\"id\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1603bc4b-c829-4897-806b-558f5ff17cb1\",\"type\":\"BasicTicker\"}},\"id\":\"554859af-aad3-4282-8c22-68a0ba30945d\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"38639514-4a04-4775-affb-bb8ae557c7d8\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4801e300-cd71-457a-b0c1-7babf53db771\",\"type\":\"BasicTicker\"}},\"id\":\"6b62e388-5254-4b78-868d-0c9e97178eb0\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"4801e300-cd71-457a-b0c1-7babf53db771\",\"type\":\"BasicTicker\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4801e300-cd71-457a-b0c1-7babf53db771\",\"type\":\"BasicTicker\"}},\"id\":\"fd3d6cc7-5e71-492e-b0ba-eff599c9cfe2\",\"type\":\"Grid\"},{\"attributes\":{\"below\":[{\"id\":\"6437be4c-7a5b-43ed-8fcf-d8344c3e6517\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"6b62e388-5254-4b78-868d-0c9e97178eb0\",\"type\":\"LinearAxis\"}],\"plot_height\":300,\"plot_width\":700,\"renderers\":[{\"id\":\"6437be4c-7a5b-43ed-8fcf-d8344c3e6517\",\"type\":\"LinearAxis\"},{\"id\":\"554859af-aad3-4282-8c22-68a0ba30945d\",\"type\":\"Grid\"},{\"id\":\"6b62e388-5254-4b78-868d-0c9e97178eb0\",\"type\":\"LinearAxis\"},{\"id\":\"fd3d6cc7-5e71-492e-b0ba-eff599c9cfe2\",\"type\":\"Grid\"},{\"id\":\"f3ea42a5-18cd-4ce8-90b5-b9dba9629774\",\"type\":\"BoxAnnotation\"},{\"id\":\"d77fcda3-5f9c-4a8b-9ba7-5419895529c5\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"94109c38-6364-42af-815a-de0fad662c12\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"56eedf3a-6441-4c12-bbf8-08e34dfda225\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"f4ca60d9-5719-44c0-8098-070f02f1fb52\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"017846b5-4a4a-45d9-915a-823eac0acdbe\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"def48a5e-ccd0-44ca-a4c4-04ed07ee2e3f\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"bf7fc4ef-b643-4d93-b3a6-bb2ff800d9a9\",\"type\":\"LinearScale\"}},\"id\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\",\"subtype\":\"Figure\",\"type\":\"Plot\"}],\"root_ids\":[\"70e10303-43fc-44ae-a1ec-f3193400a7b1\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.13\"}};\n", " var render_items = [{\"docid\":\"47b29999-a5e7-4ecc-bc06-8b3e16ac1a31\",\"elementid\":\"227ea7ba-29f4-4754-8a87-893ce053c8fe\",\"modelid\":\"70e10303-43fc-44ae-a1ec-f3193400a7b1\"}];\n", " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", "\n", " }\n", " if (root.Bokeh !== undefined) {\n", " embed_document(root);\n", " } else {\n", " var attempts = 0;\n", " var timer = setInterval(function(root) {\n", " if (root.Bokeh !== undefined) {\n", " embed_document(root);\n", " clearInterval(timer);\n", " }\n", " attempts++;\n", " if (attempts > 100) {\n", " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\")\n", " clearInterval(timer);\n", " }\n", " }, 10, root)\n", " }\n", "})(window);" ], "application/vnd.bokehjs_exec.v0+json": "" }, "metadata": { "application/vnd.bokehjs_exec.v0+json": { "id": "70e10303-43fc-44ae-a1ec-f3193400a7b1" } }, "output_type": "display_data" } ], "source": [ "# NOTICE: In Jupyter and Python3 you can use UNICODE identifiers as variable names.\n", "# Example: just type \\alpha and press \n", "β = np.linspace(0, 3*np.pi, 700)\n", "fig = bk.figure(title=\"A simple Chirp\",\n", " plot_width = 700, plot_height = 300)\n", "fig.title.text_font_size=\"18pt\"\n", "fig.line(β, np.sin(β**2), line_width=2, line_color='magenta')\n", "bk.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5 Interactive Widgets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "IPython comes with basic widgets that represent common interactive controls." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5.1 Plot controlled by Widgets" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "88dff6e9460c4d18a6d5b0264087eb2b", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(FloatSlider(value=2.0, description='n', max=30.0, min=2.0), FloatSlider(value=1.0, description='lw', max=10.0, min=0.5, step=0.5), Dropdown(description='c', options=('blue', 'green', 'red'), value='blue'), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import ipywidgets\n", "from ipywidgets import interact\n", "\n", "# Here \"interact\" is used as a decorator:\n", "@interact(n=(2.0,30.0), lw=(0.5, 10.0, 0.5), c=(['blue', 'green', 'red']))\n", "def edit_myplot(n=2.0, lw=1.0, c='blue'):\n", " fig = bk.figure(title=\"An interactive Chirp\",\n", " plot_width = 700, plot_height = 300)\n", " fig.title.text_font_size=\"18pt\"\n", " fig.line(β, np.sin(β**n), line_width=lw, line_color=c)\n", " bk.show(fig)\n", " return" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5.2 Factorization Example using Interactive Widgets and SimPy" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "from IPython.display import display\n", "from sympy import Symbol, Eq, factor, init_printing\n", "init_printing(use_latex='mathjax')" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "def factorit(n):\n", " x = Symbol('x')\n", " display(Eq(x**n-1, factor(x**n-1)))" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d0a9c338069f40738531eb33ed915f0e", "version_major": 2, "version_minor": 0 }, "text/html": [ "

Failed to display Jupyter Widget of type interactive.

\n", "

\n", " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "

\n", "

\n", " If you're reading this message in another frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "

\n" ], "text/plain": [ "interactive(children=(IntSlider(value=31, description='n', max=60, min=2), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "interact(factorit, n=(2,60));\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6 Markdown cells can contain formatted text and code" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can *italicize*, **boldface** or `typewrite` text\n", "\n", "* build\n", "* lists\n", "\n", "and embed code meant for illustration instead of execution in Python:\n", "\n", " def f(x):\n", " \"\"\"a docstring\"\"\"\n", " return x**2\n", "\n", "or other languages:\n", "\n", " if (i=0; i\n", " " ], "text/plain": [ "" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Video credit: Fernando Pérez, Brian E. Granger, Min Ragan-Kelley\n", "from IPython.display import YouTubeVideo\n", "YouTubeVideo('Rc4JQWowG5I', width=800, height=420)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7.2 External Websites" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can even embed an entire page from another site in an iframe; for example this is today's Wikipedia\n", "page for mobile users:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "