Menu

Statistical
Static
29 Python scripts generated for psychometric function this week

Psychometric Function

Chart overview

A psychometric function plots the proportion of correct or detected responses as a function of stimulus intensity and fits a sigmoidal curve - typically a cumulative Gaussian or logistic function - to estimate the perceptual threshold and slope.

Key points

  • Psychophysicists and sensory neuroscientists use it to characterise sensory sensitivity and the steepness of the transition from chance to ceiling performance.
  • It is a cornerstone tool for measuring detection, discrimination, and recognition thresholds.

Python Tutorial

How to create a psychometric function in Python

Use the full tutorial for implementation details, troubleshooting, and chart variations in matplotlib, seaborn, and plotly.

Complete Guide to Scientific Data Visualization

Example Visualization

Psychometric function showing proportion correct data points with a fitted sigmoid curve, threshold and slope annotations, and chance level dashed line

Create This Chart Now

Generate publication-ready psychometric functions 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 psychometric function plot from my behavioural data. Fit a cumulative Gaussian or logistic sigmoid to the proportion-correct values, mark the 75% threshold with dashed lines, show raw data points with binomial error bars, and format in a journal-quality style."

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 Psychometric Function code automatically.

3

Customize & Export

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

Newsletter

Get one weekly tip for better psychometric functions

Join researchers receiving concise Python plotting techniques to improve chart clarity and reduce revision cycles.

No spam. Unsubscribe anytime.

Python Code Example

example.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit

def sigmoid(x, L ,x0, k, b):
    return L / (1 + np.exp(-k*(x-x0))) + b

x_data = np.linspace(0.1, 0.9, 9)
y_data = np.array([0.05, 0.1, 0.15, 0.3, 0.55, 0.8, 0.9, 0.95, 0.98])
y_err = np.random.uniform(0.02, 0.08, len(x_data))

x_fit = np.linspace(0, 1, 100)
y_fit = sigmoid(x_fit, 1, 0.5, 10, 0)

plt.figure(figsize=(10, 6))
plt.errorbar(x_data, y_data, yerr=y_err, fmt='ko', capsize=5, label='Subject Responses')
plt.plot(x_fit, y_fit, 'b-', linewidth=2, label='Fitted Psychometric Function')
plt.axhline(0.5, color='gray', linestyle='--')
plt.axvline(0.5, color='gray', linestyle='--')
plt.title('Psychometric Function', fontsize=14, fontweight='bold', pad=20)
plt.xlabel('Stimulus Intensity', fontsize=12)
plt.ylabel('Probability of Response', fontsize=12)
plt.legend()
plt.tight_layout()
plt.savefig('plotivy-psychometric-function.png', dpi=150)
print("Psychometric function generated successfully.")

Opens the Analyze page with this code pre-loaded and ready to execute

Console Output

Output
Psychometric function generated successfully.

Common Use Cases

  • 1Measuring contrast detection thresholds in visual psychophysics experiments
  • 2Estimating auditory frequency discrimination thresholds in hearing research
  • 3Quantifying tactile sensitivity changes after peripheral nerve injury
  • 4Comparing perceptual thresholds across age groups or clinical populations

Pro Tips

Use maximum likelihood estimation rather than least-squares for fitting proportion data

Plot binomial confidence intervals at each stimulus level, not just the fitted curve

Mark threshold and just-noticeable difference (JND) explicitly with dashed reference lines

Show the chance level (0.5 for two-alternative forced choice) as a horizontal dashed line

Long-tail keyword opportunities

how to create psychometric function in python
psychometric function matplotlib
psychometric function seaborn
psychometric function plotly
psychometric function scientific visualization
psychometric function publication figure python

High-intent chart variations

Psychometric Function with confidence interval overlays
Psychometric Function optimized for publication layouts
Psychometric Function with category-specific color encoding
Interactive Psychometric Function for exploratory analysis

Library comparison for this chart

matplotlib

Best when you need full control over axis formatting, annotation placement, and journal-specific styling for psychometric-function.

numpy

Useful in specialized workflows that complement core Python plotting libraries for psychometric-function analysis tasks.

scipy

Useful in specialized workflows that complement core Python plotting libraries for psychometric-function analysis tasks.

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.