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.

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.

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

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.