Bokeh inside Google Colab

前端 未结 3 775
孤街浪徒
孤街浪徒 2021-01-03 02:31

Matplotlib doesn\'t give me the visualisation I want

I like the interactive features of Bokeh and I would like to see if someone was able to get it running inside Go

相关标签:
3条回答
  • 2021-01-03 02:46

    I made a library to make it easier to use bokeh in Colab

    First install it

    !pip install kora
    

    Then your can plot a figure easily

    from kora.bokeh import figure
    p = figure(100, 200)  # h, w
    p.line([1, 2, 3, 4], [6, 7, 2, 4])
    p # display itself, don't need show()
    

    If you call from kora import bokeh, it can work the same as import bokeh. Or you can use them together as well. What I did is just create _repr_html_() that help display the Figure object.

    0 讨论(0)
  • 2021-01-03 02:52

    It did not work for me in Firefox. Switched to Chrome and it worked.

    0 讨论(0)
  • 2021-01-03 03:07

    There's a Bokeh sample in the charts example notebook.

    I suspect the important bit you'll need to add is:

    from bokeh.io import output_notebook
    output_notebook()
    

    And most importantly output_notebook() must be called inside the same cell

    0 讨论(0)
提交回复
热议问题