Search code examples
jfreechartscatter-plotscatter

How can JFreeChart print a scatter point directly on the x axis?


I try to make a scatter chart but the data point is not exactly at the (2,0) coordinate and only partly visible. The image shows the generated output from JFreeChart:

https://i.sstatic.net/oGpZW.png

But it should be like this (made with GIMP):

https://i.sstatic.net/dqrnh.jpg

Does anybody know how to do it?

thanks for any help!!!


Solution

  • For anybody else, here is the solution, which didn't satisfy me completely but is acceptable:

    https://i.sstatic.net/70TbB.png

    The interesting lines of code to do so were:

    plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    plot.getRangeAxis().setLowerMargin(0);