# coding: utf-8 This IPython Notebook contains simple examples of the line function. To clear all previously rendered cell outputs, select from the menu: Cell -> All Output -> Clear # In[1]: import numpy as np from scipy.integrate import odeint # In[2]: from bokeh.plotting import figure, output_notebook, show # In[3]: sigma = 10 rho = 28 beta = 8.0/3 theta = 3 * np.pi / 4 # In[4]: def lorenz(xyz, t): x, y, z = xyz x_dot = sigma * (y - x) y_dot = x * rho - x * z - y z_dot = x * y - beta* z return [x_dot, y_dot, z_dot] # In[5]: initial = (-10, -7, 35) t = np.arange(0, 100, 0.001) # In[6]: solution = odeint(lorenz, initial, t) # In[7]: x = solution[:, 0] y = solution[:, 1] z = solution[:, 2] xprime = np.cos(theta) * x - np.sin(theta) * y # In[8]: colors = ["#C6DBEF", "#9ECAE1", "#6BAED6", "#4292C6", "#2171B5", "#08519C", "#08306B",] # In[9]: output_notebook() # In[10]: p = figure(title="lorenz example") p.multi_line(np.array_split(xprime, 7), np.array_split(z, 7), line_color=colors, line_alpha=0.8, line_width=1.5) # In[11]: show(p)