Distribution
Static

Density Plot

Density plots provide a smooth, continuous estimate of the probability density function of a random variable. Unlike histograms, they don't depend on bin size and provide a cleaner view of the underlying distribution shape. Density plots are excellent for comparing distributions between groups and identifying multimodal patterns in your data.

Example Visualization

Density plot showing distribution of test scores with shaded area

Try this prompt

"Create a density plot (KDE) showing the distribution of 'SAT Scores' for 1000 students across 3 school districts. Generate realistic data: District A (urban, mean=1100, sd=150), District B (suburban, mean=1200, sd=120), District C (private, mean=1300, sd=100). Shade the area under each curve with semi-transparent fills using distinct colors. Add vertical dashed lines for each district's mean with annotations. Include a vertical line at the national average (1060). Add a rug plot showing individual observations (alpha=0.1). X-axis: 'SAT Score (400-1600)', Y-axis: 'Density'. Add legend with district names and sample sizes. Title: 'SAT Score Distribution by School District'."

Python Code Example

Loading code...

Common Use Cases

  • 1Comparing distributions between groups
  • 2Identifying multimodal distributions
  • 3Visualizing probability density
  • 4Smoothed frequency analysis

Pro Tips

Adjust bandwidth for optimal smoothing

Use fill with transparency for overlapping distributions

Add rug plots to show individual data points