Skip to content

Instantly share code, notes, and snippets.

@sizhky
Created December 31, 2018 05:01
Show Gist options
  • Save sizhky/3dfd734b24a8822964c8f5d70aaa9c8c to your computer and use it in GitHub Desktop.
Save sizhky/3dfd734b24a8822964c8f5d70aaa9c8c to your computer and use it in GitHub Desktop.
from bokeh.plotting import figure, show
from bokeh.io import output_notebook, push_notebook
%matplotlib inline
output_notebook()
from math import pi
import numpy as np
from time import sleep
p = figure(title="X vs Random Number Generator", plot_height=350, plot_width=800)
target = show(p, notebook_handle=True)
x, y = [], []
for i in range(100):
# 1. make data
x.append(i)
y.append(i*0.1*np.random.randint(0, 10))
# 2. call plot
p.line(x, y)
# 3. push_notebook to the concerned target
push_notebook(handle=target)
sleep(0.001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment