Learn BEAKERX with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in BeakerX (Scala)
println("Hello World")
A simple Scala Hello World example in BeakerX.
2
Polyglot Example in BeakerX (Scala + Python)
// Scala cell
val nums = Array(1, 2, 3, 4, 5)
nums.sum
# Python cell
nums = beakerx.get("nums")
print(sum(nums))
An example showing data shared between Scala and Python cells in BeakerX.
3
Hello World in BeakerX (Python)
print("Hello from Python in BeakerX!")
Basic Python Hello World executed inside a BeakerX Notebook.
4
BeakerX Table Display (Python)
from beakerx import *
TableDisplay([[1, "A"], [2, "B"], [3, "C"]])
Display a table using BeakerX's built-in table widget.
5
BeakerX Plot Example (Groovy)
import com.twosigma.beakerx.chart.xychart.Plot
import com.twosigma.beakerx.chart.xychart.plotitem.Line
p = new Plot()
line = new Line()
line.x = [1, 2, 3, 4]
line.y = [10, 20, 25, 30]
p.add(line)
p
A simple BeakerX line plot using Groovy.
6
BeakerX Interactive Widget (Python)
from ipywidgets import IntSlider, interact
def show(x):
print("Value:", x)
interact(show, x=IntSlider(min=0, max=10, step=1, value=5))
Using a BeakerX widget slider to update output.
7
BeakerX Groovy Hello World
println "Hello from Groovy!"
Simple Groovy Hello World example.
8
SQL Magic in BeakerX
%classpath add mvn org.xerial sqlite-jdbc 3.34.0
%sql sqlite:sample.db
CREATE TABLE IF NOT EXISTS demo (id INT, name TEXT);
INSERT INTO demo VALUES (1, 'Alice');
SELECT * FROM demo;
Using BeakerX SQL cell magic to execute queries.
9
Java Hello World in BeakerX
System.out.println("Hello from Java in BeakerX!");
A basic Java Hello World example executed in BeakerX.
10
R Plot in BeakerX
x <- c(1,2,3,4,5)
y <- c(5,4,3,2,1)
plot(x, y, main="BeakerX R Plot", col="blue")
Using R inside BeakerX to create a scatter plot.