Spike Raster Plot
Chart overview
A spike raster plot represents each action potential as a vertical tick mark, arranged by trial or neuron on the y-axis and time on the x-axis.
Key points
- Neuroscientists use it to visualize spiking activity in response to experimental stimuli across repeated trials.
- It reveals firing rate modulation, response latency, and trial-to-trial variability at a glance.
Python Tutorial
How to create a spike raster plot in Python
Use the full tutorial for implementation details, troubleshooting, and chart variations in matplotlib, seaborn, and plotly.
Python Scatter Plot TutorialExample Visualization

Create This Chart Now
Generate publication-ready spike raster plots with AI in seconds. No coding required – just describe your data and let AI do the work.
View example prompt
"Create a spike raster plot from my data. Plot each spike as a vertical tick mark, group rows by trial or neuron, align to stimulus onset at time zero, and use a publication-quality style with a Nature Neuroscience journal format."
How to create this chart in 30 seconds
Upload Data
Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.
AI Generation
Our AI analyzes your data and generates the Spike Raster Plot code automatically.
Customize & Export
Tweak the design with natural language, then export as high-res PNG, SVG or PDF.
Newsletter
Get one weekly tip for better spike raster plots
Join researchers receiving concise Python plotting techniques to improve chart clarity and reduce revision cycles.
Python Code Example
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
n_trials = 20
times = [np.random.uniform(0, 1, np.random.randint(5, 20)) for _ in range(n_trials)]
plt.figure(figsize=(10, 6))
plt.eventplot(times, color='black', linelengths=0.8)
plt.title('Spike Raster Plot', fontsize=14, fontweight='bold', pad=20)
plt.xlabel('Time (s)', fontsize=12)
plt.ylabel('Trial Number', fontsize=12)
plt.yticks(np.arange(0, n_trials, 5))
plt.grid(axis='x', alpha=0.3)
plt.tight_layout()
plt.savefig('plotivy-spike-raster-plot.png', dpi=150)
print("Spike raster plot generated successfully.")
Opens the Analyze page with this code pre-loaded and ready to execute
Console Output
Spike raster plot generated successfully.
Common Use Cases
- 1Single-unit electrophysiology during sensory stimulation paradigms
- 2Population coding analysis across simultaneously recorded neurons
- 3Comparing spike timing reliability across experimental conditions
- 4Identifying burst firing patterns and refractory periods in vivo
Pro Tips
Align all trials to a common event (stimulus onset or response) on the x-axis
Sort trials by reaction time or a behavioural variable to reveal structure
Use thin tick marks (linewidth ~0.5) and low alpha to avoid visual clutter with many trials
Overlay a smoothed PSTH above or below the raster for a combined view
Long-tail keyword opportunities
High-intent chart variations
Library comparison for this chart
matplotlib
Best when you need full control over axis formatting, annotation placement, and journal-specific styling for spike-raster-plot.
numpy
Useful in specialized workflows that complement core Python plotting libraries for spike-raster-plot analysis tasks.
Scientific Chart Selection Cheat Sheet
Not sure whether to use a Violin Plot, Box Plot, or Ridge Plot? Download our single-page reference mapping the most-used scientific chart types, exactly when to use them, and the core Matplotlib/Seaborn functions.