Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bokeh.models import HoverTool
- from bokeh.plotting import figure, show, output_file, ColumnDataSource
- from bokeh.layouts import gridplot
- from bokeh.palettes import magma
- def plot(u, descs=index_to_interesting_subject):
- source = ColumnDataSource(data=dict(
- x1=u[:, 0],
- x2=u[:, 1],
- x3=u[:, 2],
- x4=u[:, 3],
- desc=descs,
- ))
- hover = HoverTool(tooltips=[
- ("index", "$index"),
- ("desc", "@desc"),
- ])
- def plot_it(x, y):
- p = figure(plot_width=250, plot_height=250, tools=[hover])
- p.scatter(
- x, y,
- size=5,
- source=source,
- line_color=None,
- alpha=0.8,
- )
- return p
- p12 = plot_it('x2', 'x1')
- p13 = plot_it('x3', 'x1')
- p14 = plot_it('x4', 'x1')
- p23 = plot_it('x3', 'x2')
- p24 = plot_it('x4', 'x2')
- p34 = plot_it('x4', 'x3')
- grid = gridplot([[p12, p13, p14], [None, p23, p24], [None, None, p34]])
- output_file("word_doc.html", title="word-doc")
- show(grid)
- plot(u)
Add Comment
Please, Sign In to add comment