samuelcolvin / Bokeh.jl

Bokeh Bindings for Julia
Other
46 stars 14 forks source link

Need IJulia Docs #17

Closed dhoegh closed 9 years ago

dhoegh commented 9 years ago

I just added and tried Bokeh, if I run the following in IJulia i get an error

using Bokeh

autoopen(true)

x = linspace(0, 2pi)
y = sin(x)
plot(x, y)
Out[1]:
Plot("Bokeh Plot" with 1 datacolumns)
Javascript error adding output!
ReferenceError: Bokeh is not defined
See your browser Javascript console for more details.

julia>versioninfo()
Julia Version 0.3.6
Commit 0c24dca (2015-02-17 22:12 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

the output in the js console is:

image

samuelcolvin commented 9 years ago

humm, I haven't tried IJulia for some time. is it working ok from the terminal?

dhoegh commented 9 years ago

Yes it works in the terminal.

samuelcolvin commented 9 years ago

Ok, thanks for the feedback, I'll try and fix it when I have a chance.

If you want to have a look at fixing it yourself, I would have a look at the writemime function for HTML and renderplot, is it correctly setting isijulia=true in renderplot?

samuelcolvin commented 9 years ago

Turns out I had forgotten myself how to use IJulia, you just need setupnotebook().

This should work fine:

using Bokeh
setupnotebook()

x = linspace(0, 2pi)
y = sin(x)
plot(x, y)

Let me know if there's still a problem.

I'll leave this open as I need to document how to use Bokeh.jl with IJulia.

dhoegh commented 9 years ago

It seems wierd to require the user to do setupnotebook() when it can be detected, if it runs in a notebook. See https://github.com/stevengj/PyPlot.jl/blob/master/src/PyPlot.jl#L159

samuelcolvin commented 9 years ago

better?

dhoegh commented 9 years ago

Yes, first time the plot did not show up before I saved, closed and then reopened the notebook and when I then executed the code the kernel died. But after a restart I can't seem to reproduce it.

samuelcolvin commented 9 years ago

I've had the same problem in the past, I asked about it somewhere (can't remember where) and no one seemed to understand.

If it persists I guess it's a problem the ipython people might be able to help with.

damianavila commented 9 years ago

when it can be detected, if it runs in a notebook.

I don't know the IJulia internals, but I guess IJulia is defined at the kernel level, I mean, it is defined with a terminal, with a qt-based terminal, with a notebook... at the end, technically, is not possible to know if you are in a notebook... and that's because of the model frontend - kernel embedded in the IPython architecture... but I repeat, maybe I am missing something about IJulia which resolves this no "knowledge" between the parts of the system... at the end just thinking loud... jeje