package indiji.mlplot.demo;
import indiji.mlplot.MLPlot;
import indiji.mlplot.MLPlot.Style;
import indiji.mlplot.MLPlot.Symbol;
import java.io.File;
public class Demo4 {
public static void main(String[] args){
// Create data
double x[]=new double[30];
double y_sine[]=new double[30];
double y_cosine[]=new double[30];
double y_err[]=new double[30];
double y_err2[]=new double[30];
for(int n=0;n<x.length;n++){
x[n]=2*Math.PI*n/x.length;
y_sine[n]=Math.random()/3+Math.sin(x[n]);
y_cosine[n]=Math.random()+Math.cos(x[n]);
y_err[n]=Math.random()/7;
y_err2[n]=Math.random()/3;
}
// Create a new Plot
MLPlot p=new MLPlot();
// Draw data
p.linePlot(x,y_sine,"blue",Style.Solid,Symbol.Star,"Something",3,y_err);
p.linePlot(x,y_cosine,"red",Style.Solid,Symbol.Circle,"Else",3,y_err2);
// Customize Plot
p.setTitle("..something with errorbars..");
p.setLegendPos("NE");
// Save Vector/Bitmap Graphics
p.save(new File("demo4.svg"));
p.save(new File("demo4.jpg"),800);
p.save(new File("demo4.eps"));
}
}