Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bokeh.plotting import figure, curdoc
- from bokeh.models import HoverTool, TapTool, BoxZoomTool, BoxSelectTool, PreviewSaveTool, ResetTool
- from bokeh.models.widgets import Panel, Tabs, TextInput, RadioGroup
- from bokeh.models import Range1d, LogAxis, LinearAxis
- from bokeh.client import push_session
- from bokeh.models.sources import ColumnDataSource
- from bokeh.io import vform, hplot
- from bokeh.palettes import Spectral11
- import numpy as np
- tabs = []
- x = np.linspace(-2*np.pi, 2*np.pi, 200)
- colour_list = Spectral11 #[(51, 153, 51) ,(153, 51, 51), (51, 51, 153), (153, 51,153 ), (153, 51, 51)]
- y = 2*x**2 + 7/4.*x - 4
- w = 1/100.* x**3 - x**2 + 45*x + 4
- a = ColumnDataSource(dict(x = x, y = y, label = ["Second degree equation"]*len(x)))
- b = ColumnDataSource(dict(x = x, y = w, label = ["Third degree equation"]*len(x)))
- Tools = "pan,wheel_zoom,box_zoom,reset,hover,previewsave"
- figure_obj = figure(plot_width = 1000, plot_height = 800, title = "these are polinominals", tools = Tools)
- hover = figure_obj.select_one(HoverTool).tooltips = [("degree", "@label"), ("(x,y)", "($x, $y)") ]
- line_render_one = figure_obj.line("x", "y", source = a, line_width = 2, line_color = colour_list[3])
- line_render_two = figure_obj.line("x", "y", source = b, line_width = 2, line_color = colour_list[1])
- line_renders = [line_render_one, line_render_two]
- session = push_session(curdoc())
- session.show()
- session.loop_until_closed()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement