Created
September 12, 2015 19:02
-
-
Save cyberbikepunk/70b856237760010b5792 to your computer and use it in GitHub Desktop.
Render a Bokeh plot with the server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Render a simple plot with the Bokeh server\n", | |
"Before you can output the plot, you have to start the Bokeh server by running `bokeh-server` inside the shell. Then run the following script." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Using saved session configuration for http://localhost:5006/\n", | |
"To override, pass 'load_from_config=False' to Session\n" | |
] | |
} | |
], | |
"source": [ | |
"from bokeh.plotting import figure, output_server, show\n", | |
"\n", | |
"output_server(\"myplot\") # THIS LINE HAS CHANGED!\n", | |
"\n", | |
"p = figure(plot_width=400, plot_height=400)\n", | |
"\n", | |
"# add a line renderer\n", | |
"p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)\n", | |
"\n", | |
"show(p)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.4.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment