public void ExecuteRecipe(Plot plt) { // obtain a signal for the voltage double[] ap = DataGen.ActionPotential(); plt.Title("Neuronal Action Potential"); // data is sampled at 20 kHz but we want to display ms units int sampleRate = 20; plt.XAxis.Label("Time (milliseconds)"); // plot the voltage in blue on the primary Y axis var sig1 = plt.AddSignal(ap, sampleRate); sig1.YAxisIndex = 0; sig1.LineWidth = 3; sig1.Color = Color.Blue; plt.YAxis.Label("Membrane Potential (mV)"); plt.YAxis.Color(Color.Blue); // calculate the first derivative double[] deriv = new double[ap.Length]; for (int i = 1; i < deriv.Length; i++) { deriv[i] = (ap[i] - ap[i - 1]) * sampleRate; } deriv[0] = deriv[1]; // plot the first derivative in red on the secondary Y axis var sig2 = plt.AddSignal(deriv, sampleRate); sig2.YAxisIndex = 1; sig2.LineWidth = 3; sig2.Color = Color.FromArgb(120, Color.Red); plt.YAxis2.Label("Rate of Change (mV/ms)"); plt.YAxis2.Color(Color.Red); plt.YAxis2.Ticks(true); // zoom in on the interesting area plt.SetAxisLimits(40, 60); }