Created
May 16, 2018 21:16
-
-
Save jessstringham/6635d5fee54bfecdb440e136a6462bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment