-
Notifications
You must be signed in to change notification settings - Fork 16
Minimal example for Jupyter notebooks? #24
Comments
bokeh-scala generates HTML with plots as instances of
The remainder is on the specific Scala kernel. In IScala (a variation of my own) there was build-in support for Note this works with bokeh-scala 0.7 and bokehjs pre-0.11. bokehjs 0.11 changed a lot, so this API may change as well. I will the notebook case in mind (I'm currently working on a new release). |
I did this recently w/ a Jupyter notebook and a Scala kernel. I didn't need to modify bokeh-scala. Here's a couple of helper functions I wrote (which make use of a method repl.showHtml that tells the kernel to send a message to the notebook to display the passed in HTML): def initBokeh() = {
import io.continuum.bokeh.{Resources, HTMLFragment}
val resources = io.continuum.bokeh.Resources.default
val fragment = new HTMLFragment(scala.xml.NodeSeq.Empty, resources.styles, resources.scripts)
val writer = new java.io.StringWriter()
scala.xml.XML.write(writer, <div> { fragment.preamble } </div>, "UTF-8", xmlDecl=false, doctype=null)
repl.showHtml(writer.toString)
}
def showBokehPlot(plot: io.continuum.bokeh.Plot) = {
val writer = new java.io.StringWriter()
val document = new io.continuum.bokeh.Document(plot)
scala.xml.XML.write(writer, document.fragment.html(0), "UTF-8", xmlDecl=false, doctype=null)
val result = writer.toString
repl.showHtml(result)
} |
Which kernel are people recommending at this point for Bokeh Scala? |
Do you think you could impliment support for Toree and others using jvm-repr (https://github.com/jupyter/jvm-repr)? |
I would love to combine scala-bokeh with jupyter notebooks running a scala/spark kernel. I can import scala-bokeh dependencies into my notebook - any tips as to how I can create a minimal chart and display it in the notebook?
The text was updated successfully, but these errors were encountered: