public void CreateScatterplot(ZedGraphControl zgc, double[,] graph)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = columnNames[0];
myPane.YAxis.Title.Text = columnNames[1];
// Classification problem
PointPairList list1 = new PointPairList(); // Z = -1
PointPairList list2 = new PointPairList(); // Z = +1
for (int i = 0; i < graph.GetLength(0); i++)
{
if (graph[i, 2] == -1)
list1.Add(graph[i, 0], graph[i, 1]);
if (graph[i, 2] == 1)
list2.Add(graph[i, 0], graph[i, 1]);
}
// Add the curve
LineItem myCurve = myPane.AddCurve("G1", list1, Color.Blue, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2", list2, Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
// Fill the background of the chart rect and pane
//myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
//myPane.Fill = new Fill(Color.White, Color.SlateGray, 45.0f);
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}