views:

206

answers:

2

I know there are many comparisons of java plotting libraries out there, but I'm not finding what I need. I just want a mind-numbingly simple toolkit that creates images of scatterplots from a set of coordinates. No GUI, no interaction, no fancy display, just a basic XY coordinate system with points.

It wouldn't be the end of the world to use something that offers a lot more functionality than I need, but I'd rather not. Do you know of anything like what I'm looking for?

A: 

You an use a custom JPanel to draw your data(not tested, but you get the idea...)

private List<Point2D> data=(...);

JPanel pane=new JPanel()
{
protected paintComponent(Graphics2D g)
{
super.paintComponent(g);
int minx=(...),miny=(...),maxx=(...),maxy=(...);
for(Point2D p: data)
 {
 int x=((p.getX()-minx)/(maxx-minx))*this.getWidth();
 int y=((p.getY()-miny)/(maxy-miny))*this.getHeight();
 g.drawLine(x-5,y,x+5,y);
 g.drawLine(x,y-5,x,y+5);
 }
}
pane.setOpaque(true);
(...)
anotherComponent.add(pane);
(...)
}
Pierre
+4  A: 

Have you looked at JFreeChart? While it can do some very advanced things, it also does the simple as well. Shown below is a screenshot of its scatter plot capability.

alt text

JasCav