Guest User

Untitled

a guest
Jan 29th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. from bokeh.plotting import figure, curdoc
  2. from bokeh.models.widgets import Panel, Tabs, TextInput
  3. from bokeh.client import push_session
  4. from bokeh.io import hplot
  5. from bokeh.palettes import Spectral11
  6.  
  7. import numpy as np
  8.  
  9. tabs = []
  10.  
  11. x = np.linspace(-2*np.pi, 2*np.pi, 200)
  12.  
  13. colour_list = Spectral11 #[(51, 153, 51) ,(153, 51, 51), (51, 51, 153), (153, 51,153 ), (153, 51, 51)]
  14.  
  15. y = np.sin(x)
  16. w = np.cos(x)
  17.  
  18. z = np.arcsin(x)
  19. u = np.arccos(x)
  20.  
  21. v = np.arctan(x)
  22. r = np.tan(x)
  23.  
  24. list_of_axis = [(y,w), (z, u), (v,r)]
  25.  
  26.  
  27. def update_title(identity, new):
  28.     figure_obj.title = identity
  29.  
  30.  
  31.  
  32. for two in list_of_axis:
  33.  
  34.     figure_obj = figure(plot_width = 1000, plot_height = 800, title = "these are waves")   
  35.     figure_obj.line(x, two[0], line_width = 2, line_color = colour_list[3])
  36.     figure_obj.line(x, two[1], line_width = 2, line_color = colour_list[1])
  37.  
  38.     #text = TextInput(title="title", value='my sine wave')
  39.     #identity = "hello I am plot"
  40.     #text.on_change('value', lambda attr, old, new: update_title(identity, new))
  41.  
  42.     tabs.append(Panel(child = figure_obj, title = "two by two"))
  43.  
  44. tabs = Tabs(tabs = tabs)
  45. session = push_session(curdoc())
  46. session.show()
  47. session.loop_until_closed()
Advertisement
Add Comment
Please, Sign In to add comment