Menu

Statistical
Static
50 Python scripts generated for spike raster plot this week

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.

Example Visualization

Spike raster plot showing vertical tick marks representing individual action potentials arranged by trial on y-axis and time on x-axis

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
Example AI 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

1

Upload Data

Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.

2

AI Generation

Our AI analyzes your data and generates the Spike Raster Plot code automatically.

3

Customize & Export

Tweak the design with natural language, then export as high-res PNG, SVG or PDF.

Python Code Example

example.py
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

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

Free Cheat Sheet

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.

Comparison Charts
Distribution Charts
Time Series Data
Common Mistakes
No spam. Unsubscribe anytime.