← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-data-visualization-distribution-plots / references / usage-guide.md

Distribution Plots - Usage Guide

Overview

Distribution plots compare continuous data across a small number of groups. The default bar of mean ± SEM collapses distributional information and misleads (Weissgerber 2015). Modern alternatives are raincloud (Allen 2019) for N 30-200, beeswarm/quasirandom for N 10-30, raw points for N < 10, and letter-value plots (Hofmann 2017) or violin with explicit bandwidth for large N.

Prerequisites

install.packages(c('ggplot2', 'ggbeeswarm', 'ggdist', 'gghalves', 'lvplot'))
pip install seaborn matplotlib ptitprince

Quick Start

Tell your AI agent what you want to do: - "Replace this bar plot with a raincloud showing each individual point" - "Plot expression per cluster with quasirandom jitter for N=15 per group" - "Make a split violin comparing condition within each cell type" - "Use Sheather-Jones bandwidth so bimodality is visible" - "Add N to each x-axis tick label"

Example Prompts

Raincloud for N 30-200

"Build a horizontal raincloud plot comparing biomarker level across 3 treatment arms (n=80 each). Show every point on one side, box+median in the middle, half-violin on the other side."

Beeswarm for small N

"Quasirandom beeswarm of expression across 6 cell types (n=15 each) with a horizontal crossbar for the median per group."

Single-cell split violin

"Split violin of gene X expression per cluster, with control vs treatment on the two halves. Use Sheather-Jones bandwidth so bimodal expression is visible."

Letter-value plot for large N

"Letter-value (boxen) plot for N=2000 per group instead of standard boxplot - preserves tail structure."

Migration from bar plot

"Convert this bar-of-mean ± SEM figure to a raincloud. Keep the same color scheme. Add N per group."

What the Agent Will Do

  1. Inspect N per group; pick encoding from the N decision table.
  2. Default to raw-point overlay for N < 30; raincloud for N 30-200; letter-value for N > 200.
  3. For violin: use explicit bw = 'SJ' (Sheather-Jones); not the default Silverman.
  4. For box + jitter: set outlier.shape = NA to avoid double-rendering outliers.
  5. Annotate N per group (x-axis tick label or text stratum).
  6. Color via Okabe-Ito or other CVD-safe palette.
  7. Apply statistical annotation via ggpubr::stat_compare_means or statannotations if requested (see statistical-annotation skill).

Tips