p2.setXindex(2); p2.setYindex(3); p2.setCindex(i.classIndex());
  public static void main(String [] args) {    try {      if (args.length < 1) {	System.err.println("Usage : weka.gui.visualize.Plot2D "			   +"<dataset> [classfier] [dataset2]");	System.exit(1);      }      final javax.swing.JFrame jf = 	new javax.swing.JFrame("Weka Knowledge Explorer: Visualize");      jf.setSize(500,400);      jf.getContentPane().setLayout(new BorderLayout());      final Plot2D p2 = new Plot2D();      jf.getContentPane().add(p2, BorderLayout.CENTER);      jf.addWindowListener(new java.awt.event.WindowAdapter() {	  public void windowClosing(java.awt.event.WindowEvent e) {	    jf.dispose();	    System.exit(0);	  }	});            p2.addMouseListener(new MouseAdapter() {	  public void mouseClicked(MouseEvent e) {	    if ((e.getModifiers() & InputEvent.BUTTON1_MASK) ==		InputEvent.BUTTON1_MASK) {	      p2.searchPoints(e.getX(), e.getY(), false);	    } else {	      p2.searchPoints(e.getX(), e.getY(), true);	    }	  }	});      jf.setVisible(true);      if (args.length >= 1) {	System.err.println("Loading instances from " + args[0]);	java.io.Reader r = new java.io.BufferedReader(				new java.io.FileReader(args[0]));	Instances i = new Instances(r);	i.setClassIndex(i.numAttributes()-1);	PlotData2D pd1 = new PlotData2D(i);	pd1.setPlotName("Master plot");	p2.setXindex(2);	p2.setYindex(3);	p2.setCindex(i.classIndex());	if (args.length > 1) {	  System.err.println("Building classifier");	  weka.classifiers.Classifier cl;	  cl = weka.classifiers.Classifier.forName(args[1],null);	  cl.buildClassifier(i);	  double [] preds = new double [i.numInstances()];	  for (int jj=0;jj<i.numInstances();jj++) {	    preds[jj] = cl.classifyInstance(i.instance(jj));	  }	  	  if (i.attribute(i.classIndex()).isNumeric()) {	    pd1.setPredictionsNumeric(true);	  } else {	    pd1.setPredictionsNumeric(false);	  }	  pd1.setPredictions(preds);	}	p2.addPlot(pd1);	if (args.length == 3) {	  System.err.println("Loading instances from " + args[2]);	  java.io.Reader rr = new java.io.BufferedReader(				 new java.io.FileReader(args[2]));	  Instances ii = new Instances(rr);	  ii.setClassIndex(i.numAttributes()-1);	  PlotData2D pd = new PlotData2D(ii);	  pd.setPlotName("2nd plot");	  pd.m_useCustomColour = true;	  /*FastVector cl = new FastVector();	    cl.addElement(Color.pink); */	  pd.m_customColour = Color.pink;	  p2.addPlot(pd);	}      }    } catch (Exception ex) {      ex.printStackTrace();      System.err.println(ex.getMessage());    }  }