+10 XP

Why Plot? The Story Neurons Tell

A neuron's story is told through plots. Raw numbers are meaningless — but a plot of voltage over time shows the entire action potential, spike pattern, and response to stimulation.

Matplotlib is the tool neuroscientists use to turn data into stories.

python
import matplotlib.pyplot as plt
Import pyplot (plotting) and numpy (math)
import numpy as np
# Time and voltage data from a neuron simulation
t = np.linspace(0, 1000, 1000)  # 1000 ms
Create time array from 0 to 1000 ms with 1000 points
V = -70 + 20*np.sin(t/100)  # simplified oscillating voltage
Create voltage data: resting potential (-70 mV) + sinusoidal oscillation
plt.figure(figsize=(10, 4))
Create empty figure canvas, 10 inches wide × 4 inches tall
plt.plot(t, V, label='Membrane Voltage')
Plot voltage vs time. label= adds it to the legend
plt.axhline(y=-55, color='r', linestyle='--', label='Threshold')
Add horizontal line at spike threshold (-55 mV) in red dashed style
plt.xlabel('Time (ms)')
Label x-axis: what does the horizontal axis represent?
plt.ylabel('Voltage (mV)')
Label y-axis: what does the vertical axis represent?
plt.title('Neuron Dynamics Over Time')
Add a title describing the entire plot
plt.legend()
Display legend showing which line is 'Membrane Voltage' and which is 'Threshold'
plt.show()
Show the plot on screen (or render it if in a Jupyter notebook)

🎯 This is the template for EVERY neuron visualization in NMA. Run it to see the plot. You'll modify it for each project, but the structure stays the same.

Why neuroscientists care:
Debugging: A plot reveals if your simulation is realistic. Bad math = obvious weird pattern.
Intuition: Equations are abstract. Plots show you what's actually happening.
Communication: When you present results to advisors, they ask 'show me a plot'. A good plot says in one image what 1000 words can't.

NMA Week 1: Your first project outputs will be plots. Week 2-4: You'll generate 10+ plots per project. Master plotting now and you're unstoppable.