public void CreateResultScatterplot(ZedGraphControl zgc, double[][] inputs, double[] expected, double[] output)
{
GraphPane myPane = zgc.GraphPane;
myPane.CurveList.Clear();
// Set the titles
myPane.Title.IsVisible = false;
myPane.XAxis.Title.Text = sourceColumns[0];
myPane.YAxis.Title.Text = sourceColumns[1];
// Classification problem
PointPairList list1 = new PointPairList(); // Z = -1, OK
PointPairList list2 = new PointPairList(); // Z = +1, OK
PointPairList list3 = new PointPairList(); // Z = -1, Error
PointPairList list4 = new PointPairList(); // Z = +1, Error
for (int i = 0; i < output.Length; i++)
{
if (output[i] == -1)
{
if (expected[i] == -1)
list1.Add(inputs[i][0], inputs[i][1]);
if (expected[i] == 1)
list3.Add(inputs[i][0], inputs[i][1]);
}
else
{
if (expected[i] == -1)
list4.Add(inputs[i][0], inputs[i][1]);
if (expected[i] == 1)
list2.Add(inputs[i][0], inputs[i][1]);
}
}
// Add the curve
LineItem
myCurve = myPane.AddCurve("G1 Hits", 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 Hits", list2, Color.Green, SymbolType.Diamond);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = false;
myCurve.Symbol.Fill = new Fill(Color.Green);
myCurve = myPane.AddCurve("G1 Miss", list3, Color.Blue, SymbolType.Plus);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = true;
myCurve.Symbol.Fill = new Fill(Color.Blue);
myCurve = myPane.AddCurve("G2 Miss", list4, Color.Green, SymbolType.Plus);
myCurve.Line.IsVisible = false;
myCurve.Symbol.Border.IsVisible = true;
myCurve.Symbol.Fill = new Fill(Color.Green);
// Fill the background of the chart rect and pane
myPane.Fill = new Fill(Color.WhiteSmoke);
zgc.AxisChange();
zgc.Invalidate();
}