18

I am looking for a java plotting library that might be as good as matplotlib is for python. I have done some research looking over SO questions, but many of them are outdated and a lot has changed in the few years since they were asked. The suggestions that come up lead to websites that at the surface seem to be offering good libraries but my needs are immediate and I cannot afford the time to use them all and find the best through experience.

And so I am asking for your experience, can any of you recommend a graphing library that is to java as matplotlib is to python (in 2013)?

onofricamila
  • 930
  • 1
  • 11
  • 20
arynaq
  • 6,710
  • 9
  • 44
  • 74
  • 1
    [JFreeChart](http://www.jfree.org/jfreechart/) or maybe even [JGraph](http://www.jgraph.com/) depending on your needs...Regardless you're going to need some time to learn the APIs – MadProgrammer Sep 24 '13 at 21:30
  • I answered a similar question here: https://stackoverflow.com/a/67768959/2760299 – topher217 Jun 01 '21 at 01:25
  • It's not mathplotlib-like, but Tablesaw's Plot.ly wrapper is a good Java plotting library. Plots are rendered in HTML/JavaScript so they can be viewed in a browser. I use it mostly in my IDE. (There's a way to write an HTML page and open your default Browser on it.) It supports a large subset of the Plot.ly chart types and configuration options. https://github.com/jtablesaw/tablesaw. Tablesaw itself is a Java dataframe. – L. Blanc Oct 09 '21 at 21:59

1 Answers1

7

There's a ton of graphing libraries available for Java. Plotting libraries? Not so much. A list is availble at https://stackoverflow.com/questions/4851035/i-am-looking-for-a-plotting-library-for-java

If none of those cut it, Here's one some quick Googling found me. While I've never used it, based off it's description JMathPlot seems really good.

Community
  • 1
  • 1
DeadlyFugu
  • 152
  • 5
  • 4
    Hi, for quick visualization I used this: https://github.com/sh0nk/matplotlib4j – Ali Ait-Bachir Jun 05 '19 at 08:00
  • @AliAit-Bachir I was going to recommend the same library, but had many problems when trying to do simple things .... like drawing geometrical figures, or plotting points (scatter) with different colors/size - it's not supported!. However, I think the lib will be improved soon, because I checked it on github and it's active. The other recommended libraries are nothing like matplotlib, so I think it is preferable to store the data into csvs and instead of using java, use python to plot (I mean, if you can do it) – onofricamila Nov 20 '19 at 15:24
  • 2
    The question itself is wrong because there is a plotting library called matplotlib. Yes, one has to use Python as its command language. But there is nothing that prevents a Java program from running a Python script, either stored in a String or in a separate .py file. Just spawn a Python interpreter and run it as a subprocess. Then one can simply display the resulting graphics on the screen, be it from a jpeg, gif, tiff, png, ps, eps, pdf, or whatever format one prefers. – Sturla Molden Jun 23 '20 at 11:16
  • link to linked question broken; may use https://web.archive.org/web/20150402020904/http://stackoverflow.com:80/questions/4851035/i-am-looking-for-a-plotting-library-for-java – lineage Jul 25 '22 at 09:13
  • I wonder what the practical implications of "no OpenGL" are though. – mavavilj Dec 06 '22 at 09:35