load('pyramidal_response.mat')
threshold = 20; % mV

hold on;
plot(time*1000.0, neuronal_data, 'color', [0.2 0.5 0.7], ...
     'linewidth', 1., 'displayname', 'Membrane voltage');
plot(spikes*1000.0, ones(size(spikes)) .* threshold, 'r.', ...
     'markersize', 15, 'displayname', 'Spike times');
line([time(1) time(end)], [threshold threshold], 'linestyle', '--', ...
     'linewidth', 0.75, 'color', [0.5 0.5 0.5], 'displayname', 'Threshold');

axes = gca();
axes.XLabel = 'Time [ms]';
axes.YLabel = 'Potential [mV]';
axes.Title = 'ELL pyramidal neuron';
axes.XLim = [[500 1700];
axes.YLim = [0 40];
axes.XMinorTick = 'on';
axes.YMinorTick = 'on';
axes.TickDir = 'out';
axes.LineWidth = 1.5;
axes.box('off')

axes.FontName = 'Times';
axes.FontSize = 8;
axes.TitleFontSizeMultiplier = 1.5;
axes.LabelFontSizeMultiplier = 1.25;

l = legend(axes, 'show');
l.Location = "northeast";
l.FontSize = 11;
l.LineWidth = 1;

fig = gcf();
fig.PaperUnits = 'centimeters';
fig.PaperSize = [15, 7];
fig.PaperPosition = [0.0 0.0 15, 7];
fig.Color = 'white';

saveas(gcf, 'spike_detection.pdf', 'pdf')