views:

217

answers:

2

I need to plot some 2d (y=f(x)) and 3d (real z=f(x,y), not just 3d-looking) datasets, as well as graphs (directed and not) from my Scala (2.8) application. Currently I am going to output charts data to text files and use external charting applications (like SciDAVis). But maybe there are more convenient and automated solutions available in Scala? Some native Scala solutions, bindings to external charting systems, Java libraries wrappers, etc? As Scala is a pretty convenient for scientific purposes, I can suppose there probably are. Do you know of any?

+3  A: 

Since Scala is compatible with Java (and produce Java bytecode), you can use the JFreeChart library.

JFreeChart is a great Java chart API. Thus I am not sure that JFreeChart can produce real 3D charts.

Benoit Courtine
+7  A: 

Scalala uses JFreeChart very nicely - if you use it that way you dont have to deal with JFreeChart directly:

val x = linspace(0,1);
plot(x, x :^ 2)
hold(true)
plot(x, x :^ 3, '.')
xlabel("x axis")
ylabel("y axis")
saveas("lines.png")

Just like matlab. No 3d plots as far as i can tell though.

Johan Prinsloo
I use scalala+jfree for 2D, and http://code.google.com/p/jzy3d/ for 3D.
retronym
Just like matlab? So it also uses an implicit state for the current figure? Oh, no…
Debilski