Building a Plotting Library on the JVM

Hi,

I thought I would ask around here as there are a lot of experienced devs.

I am looking to build a plotting library for some simulation data I am working on. This will consist of having some subset of matplotlib’s functionality. From what I understand I can use the following on the JVM:

  • JavaFX / Swing
  • Java2d / java3d
  • Java OpenGL

Could anyone kindly tell me if any of those are suitable for what I am intending to do? I do not want to use an existing plotting library as this is for a project. I can however use a lower level library to build higher level components.

Thanks!

Do you want to embed plots into games and other OpenGL applications?
Do you want to do everything from scratch basically?

  • OpenGL it is. (=>LWJGL)

Do you want this to be rendered into a separate window or embedded into a JavaFX application with nice GUI elements?
Do you want to be able to just get going and draw stuff on a canvas like with HTML5?

  • Use JavaFX, forget about anything else.

JavaFX is much much easier to start with, resonably fast and also offers GUI elements, so you do not need to worry about getting a GUI running like under OpenGL.

I don’t think what you’re looking for is OpenGL, it is too low level. My pick would be JavaFX Canvas.

Thank you for your reply!

My use case is:

Do you want to be able to just get going and draw stuff on a canvas like with HTML5?

Basically run the simulation, get the results, and plot it nicely in a variety of ways that can be manipulated by the user.

It seems JavaFX is the way to go. Any reason why you think Swing is not in the mix here?

JavaFX does (for your purposes) everything swing does, but it is more modern, powerful and in active development. There’s no reason to build your graphical app on the crusty Swing API if you don’t have to.

You can answer this question for yourself by comparing the canvas functionality of Swing and JavaFX, i bet JavaFX offers more diverse drawing functions, which is what you’re looking for.

Thank you! I am a noob so this advice is super helpful to prevent me going down an unproductive rabbit hole

Good ideas. Another one that might be easier is HTML svg.
This doesn’t require coding really but you can using JavaScript.
The resulting image will be much more portable and long lived.

Thanks for the suggestion - I must say JavaFX looks promising here, and the kind of work done with it is very impressive!

Hello

Why not using JFreeChart and/or Jzy3d? The latter relies on JOGL and has an excellent integration with Swing, AWT, SWT and OpenJFX/JavaFX. It can be used with Matlab too. Why reinventing the wheel?