[{"data":1,"prerenderedAt":688},["ShallowReactive",2],{"content-query-gNHh69TEwg":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":18,"nav":18,"presets":19,"gallery":37,"body":39,"_type":681,"_id":682,"_source":683,"_file":684,"_stem":685,"_extension":686,"sitemap":687},"/tools/ai-violin-plot","tools",false,"","Violin Plot Generator for Excel & CSV","Create violin plots online from Excel and CSV data. Compare distributions, density, and group differences with AI.","Violin Plot Generator",{"prefix":12,"label":13,"placeholder":14},"Generate a violin plot","Describe the violin plot you want to generate","e.g. violin plot of life expectancy by continent, show individual points and median",[16,17],"charts","statistics",true,[20,26,32],{"label":21,"prompt":22,"dataset_url":23,"dataset_title":24,"dataset_citation":25},"Life expectancy by region","violin plot of life expectancy by region for the most recent year, show the box and all data points, color each region differently","https://ourworldindata.org/grapher/life-expectancy.csv","Life expectancy","Our World in Data",{"label":27,"prompt":28,"dataset_url":29,"dataset_title":30,"dataset_citation":31},"GDP per capita by income group","violin plot of GDP per capita by World Bank income group, use a log scale on the y-axis, show median line","https://api.worldbank.org/v2/en/indicator/NY.GDP.PCAP.CD?downloadformat=excel","GDP per capita (current US$)","World Bank",{"label":33,"prompt":34,"dataset_url":35,"dataset_title":36,"dataset_citation":25},"Mental health prevalence by region","violin plot of mental or substance use disorder prevalence by continent, show individual country points overlaid","https://ourworldindata.org/grapher/share-with-mental-or-substance-use-disorder.csv","Share of population with mental or substance use disorders",[38],"/img/tools/violin-plot.png",{"type":40,"children":41,"toc":671},"root",[42,51,86,98,117,123,212,218,358,364,471,477,554,559,565,593,599,633,643,661],{"type":43,"tag":44,"props":45,"children":47},"element","h2",{"id":46},"what-is-a-violin-plot",[48],{"type":49,"value":50},"text","What Is a Violin Plot?",{"type":43,"tag":52,"props":53,"children":54},"p",{},[55,57,63,65,70,72,77,79,84],{"type":49,"value":56},"A ",{"type":43,"tag":58,"props":59,"children":60},"strong",{},[61],{"type":49,"value":62},"violin plot",{"type":49,"value":64}," is a chart that combines a ",{"type":43,"tag":58,"props":66,"children":67},{},[68],{"type":49,"value":69},"box plot",{"type":49,"value":71}," and a ",{"type":43,"tag":58,"props":73,"children":74},{},[75],{"type":49,"value":76},"kernel density estimate (KDE)",{"type":49,"value":78}," into a single shape. The width of the violin at any point represents how many data values fall near that level — a wide section means many observations there, a narrow pinch means few. This lets you see not just the median and spread, but the full ",{"type":43,"tag":58,"props":80,"children":81},{},[82],{"type":49,"value":83},"shape of the distribution",{"type":49,"value":85},": whether it is unimodal, bimodal, skewed, or uniform.",{"type":43,"tag":52,"props":87,"children":88},{},[89,91,96],{"type":49,"value":90},"Violin plots shine when comparing distributions ",{"type":43,"tag":58,"props":92,"children":93},{},[94],{"type":49,"value":95},"across groups",{"type":49,"value":97},". A box plot tells you the median and quartiles of each group; a violin plot tells you much more — for example, whether one group has a bimodal distribution (two clusters of values) that a box plot would hide entirely. They are widely used in biology (gene expression across cell types), economics (income by country group), social science (test scores by demographic), and clinical research (biomarker levels by treatment arm).",{"type":43,"tag":52,"props":99,"children":100},{},[101,103,108,110,115],{"type":49,"value":102},"The embedded ",{"type":43,"tag":58,"props":104,"children":105},{},[106],{"type":49,"value":107},"box",{"type":49,"value":109}," inside the violin shows the interquartile range (IQR) and median. Individual ",{"type":43,"tag":58,"props":111,"children":112},{},[113],{"type":49,"value":114},"data points",{"type":49,"value":116}," can be overlaid as a strip or jittered scatter, which is especially valuable for small samples where the KDE estimate can be misleading.",{"type":43,"tag":44,"props":118,"children":120},{"id":119},"how-it-works",[121],{"type":49,"value":122},"How It Works",{"type":43,"tag":124,"props":125,"children":126},"ol",{},[127,169,185],{"type":43,"tag":128,"props":129,"children":130},"li",{},[131,136,138,145,147,153,154,160,161,167],{"type":43,"tag":58,"props":132,"children":133},{},[134],{"type":49,"value":135},"Upload your data",{"type":49,"value":137}," — provide a CSV or Excel file with at least one numeric column and one categorical column to group by (e.g. ",{"type":43,"tag":139,"props":140,"children":142},"code",{"className":141},[],[143],{"type":49,"value":144},"country",{"type":49,"value":146},", ",{"type":43,"tag":139,"props":148,"children":150},{"className":149},[],[151],{"type":49,"value":152},"region",{"type":49,"value":146},{"type":43,"tag":139,"props":155,"children":157},{"className":156},[],[158],{"type":49,"value":159},"group",{"type":49,"value":146},{"type":43,"tag":139,"props":162,"children":164},{"className":163},[],[165],{"type":49,"value":166},"category",{"type":49,"value":168},")",{"type":43,"tag":128,"props":170,"children":171},{},[172,177,179],{"type":43,"tag":58,"props":173,"children":174},{},[175],{"type":49,"value":176},"Describe the plot",{"type":49,"value":178}," — e.g. ",{"type":43,"tag":180,"props":181,"children":182},"em",{},[183],{"type":49,"value":184},"\"violin plot of exam scores by school, show individual points and the mean line\"",{"type":43,"tag":128,"props":186,"children":187},{},[188,193,195,202,204,210],{"type":43,"tag":58,"props":189,"children":190},{},[191],{"type":49,"value":192},"Get the visualization",{"type":49,"value":194}," — the AI writes Python code using ",{"type":43,"tag":196,"props":197,"children":199},"a",{"href":198},"https://plotly.com/python/violin/",[200],{"type":49,"value":201},"Plotly",{"type":49,"value":203}," or ",{"type":43,"tag":196,"props":205,"children":207},{"href":206},"https://seaborn.pydata.org/generated/seaborn.violinplot.html",[208],{"type":49,"value":209},"seaborn",{"type":49,"value":211}," to build and style the chart",{"type":43,"tag":44,"props":213,"children":215},{"id":214},"interpreting-the-results",[216],{"type":49,"value":217},"Interpreting the Results",{"type":43,"tag":219,"props":220,"children":221},"table",{},[222,241],{"type":43,"tag":223,"props":224,"children":225},"thead",{},[226],{"type":43,"tag":227,"props":228,"children":229},"tr",{},[230,236],{"type":43,"tag":231,"props":232,"children":233},"th",{},[234],{"type":49,"value":235},"Visual element",{"type":43,"tag":231,"props":237,"children":238},{},[239],{"type":49,"value":240},"What it means",{"type":43,"tag":242,"props":243,"children":244},"tbody",{},[245,262,278,294,310,326,342],{"type":43,"tag":227,"props":246,"children":247},{},[248,257],{"type":43,"tag":249,"props":250,"children":251},"td",{},[252],{"type":43,"tag":58,"props":253,"children":254},{},[255],{"type":49,"value":256},"Width of violin",{"type":43,"tag":249,"props":258,"children":259},{},[260],{"type":49,"value":261},"Density of observations at that value — wider = more data points near that level",{"type":43,"tag":227,"props":263,"children":264},{},[265,273],{"type":43,"tag":249,"props":266,"children":267},{},[268],{"type":43,"tag":58,"props":269,"children":270},{},[271],{"type":49,"value":272},"White dot / line inside box",{"type":43,"tag":249,"props":274,"children":275},{},[276],{"type":49,"value":277},"Median",{"type":43,"tag":227,"props":279,"children":280},{},[281,289],{"type":43,"tag":249,"props":282,"children":283},{},[284],{"type":43,"tag":58,"props":285,"children":286},{},[287],{"type":49,"value":288},"Box (IQR)",{"type":43,"tag":249,"props":290,"children":291},{},[292],{"type":49,"value":293},"Middle 50% of data (25th to 75th percentile)",{"type":43,"tag":227,"props":295,"children":296},{},[297,305],{"type":43,"tag":249,"props":298,"children":299},{},[300],{"type":43,"tag":58,"props":301,"children":302},{},[303],{"type":49,"value":304},"Thin vertical line (whiskers)",{"type":43,"tag":249,"props":306,"children":307},{},[308],{"type":49,"value":309},"Range excluding outliers (typically 1.5× IQR)",{"type":43,"tag":227,"props":311,"children":312},{},[313,321],{"type":43,"tag":249,"props":314,"children":315},{},[316],{"type":43,"tag":58,"props":317,"children":318},{},[319],{"type":49,"value":320},"Scattered points",{"type":43,"tag":249,"props":322,"children":323},{},[324],{"type":49,"value":325},"Individual observations — useful for small samples",{"type":43,"tag":227,"props":327,"children":328},{},[329,337],{"type":43,"tag":249,"props":330,"children":331},{},[332],{"type":43,"tag":58,"props":333,"children":334},{},[335],{"type":49,"value":336},"Flat top or bottom",{"type":43,"tag":249,"props":338,"children":339},{},[340],{"type":49,"value":341},"Hard boundary in the data (e.g. a scale capped at 0 or 100)",{"type":43,"tag":227,"props":343,"children":344},{},[345,353],{"type":43,"tag":249,"props":346,"children":347},{},[348],{"type":43,"tag":58,"props":349,"children":350},{},[351],{"type":49,"value":352},"Two bumps (bimodal)",{"type":43,"tag":249,"props":354,"children":355},{},[356],{"type":49,"value":357},"Two distinct sub-populations within the group",{"type":43,"tag":44,"props":359,"children":361},{"id":360},"example-prompts",[362],{"type":49,"value":363},"Example Prompts",{"type":43,"tag":219,"props":365,"children":366},{},[367,383],{"type":43,"tag":223,"props":368,"children":369},{},[370],{"type":43,"tag":227,"props":371,"children":372},{},[373,378],{"type":43,"tag":231,"props":374,"children":375},{},[376],{"type":49,"value":377},"Scenario",{"type":43,"tag":231,"props":379,"children":380},{},[381],{"type":49,"value":382},"What to type",{"type":43,"tag":242,"props":384,"children":385},{},[386,403,420,437,454],{"type":43,"tag":227,"props":387,"children":388},{},[389,394],{"type":43,"tag":249,"props":390,"children":391},{},[392],{"type":49,"value":393},"Compare salary distributions",{"type":43,"tag":249,"props":395,"children":396},{},[397],{"type":43,"tag":139,"props":398,"children":400},{"className":399},[],[401],{"type":49,"value":402},"violin plot of annual salary by department, show all data points",{"type":43,"tag":227,"props":404,"children":405},{},[406,411],{"type":43,"tag":249,"props":407,"children":408},{},[409],{"type":49,"value":410},"Clinical trial outcome",{"type":43,"tag":249,"props":412,"children":413},{},[414],{"type":43,"tag":139,"props":415,"children":417},{"className":416},[],[418],{"type":49,"value":419},"violin plot of blood pressure reduction by treatment group, overlay individual patients",{"type":43,"tag":227,"props":421,"children":422},{},[423,428],{"type":43,"tag":249,"props":424,"children":425},{},[426],{"type":49,"value":427},"Academic performance",{"type":43,"tag":249,"props":429,"children":430},{},[431],{"type":43,"tag":139,"props":432,"children":434},{"className":433},[],[435],{"type":49,"value":436},"violin plot of test scores by grade level, color by school type",{"type":43,"tag":227,"props":438,"children":439},{},[440,445],{"type":43,"tag":249,"props":441,"children":442},{},[443],{"type":49,"value":444},"Country health metrics",{"type":43,"tag":249,"props":446,"children":447},{},[448],{"type":43,"tag":139,"props":449,"children":451},{"className":450},[],[452],{"type":49,"value":453},"violin plot of life expectancy by continent, log scale, show median",{"type":43,"tag":227,"props":455,"children":456},{},[457,462],{"type":43,"tag":249,"props":458,"children":459},{},[460],{"type":49,"value":461},"Gene expression",{"type":43,"tag":249,"props":463,"children":464},{},[465],{"type":43,"tag":139,"props":466,"children":468},{"className":467},[],[469],{"type":49,"value":470},"half violin plot of expression levels by cell type, mirror box plot on the right",{"type":43,"tag":44,"props":472,"children":474},{"id":473},"violin-vs-box-plot-vs-histogram",[475],{"type":49,"value":476},"Violin vs. Box Plot vs. Histogram",{"type":43,"tag":219,"props":478,"children":479},{},[480,496],{"type":43,"tag":223,"props":481,"children":482},{},[483],{"type":43,"tag":227,"props":484,"children":485},{},[486,491],{"type":43,"tag":231,"props":487,"children":488},{},[489],{"type":49,"value":490},"Chart",{"type":43,"tag":231,"props":492,"children":493},{},[494],{"type":49,"value":495},"Best for",{"type":43,"tag":242,"props":497,"children":498},{},[499,515,531],{"type":43,"tag":227,"props":500,"children":501},{},[502,510],{"type":43,"tag":249,"props":503,"children":504},{},[505],{"type":43,"tag":58,"props":506,"children":507},{},[508],{"type":49,"value":509},"Box plot",{"type":43,"tag":249,"props":511,"children":512},{},[513],{"type":49,"value":514},"Comparing many groups quickly; outlier detection",{"type":43,"tag":227,"props":516,"children":517},{},[518,526],{"type":43,"tag":249,"props":519,"children":520},{},[521],{"type":43,"tag":58,"props":522,"children":523},{},[524],{"type":49,"value":525},"Histogram",{"type":43,"tag":249,"props":527,"children":528},{},[529],{"type":49,"value":530},"Showing one group's distribution in detail",{"type":43,"tag":227,"props":532,"children":533},{},[534,542],{"type":43,"tag":249,"props":535,"children":536},{},[537],{"type":43,"tag":58,"props":538,"children":539},{},[540],{"type":49,"value":541},"Violin plot",{"type":43,"tag":249,"props":543,"children":544},{},[545,547,552],{"type":49,"value":546},"Comparing distribution ",{"type":43,"tag":180,"props":548,"children":549},{},[550],{"type":49,"value":551},"shape",{"type":49,"value":553}," across a small number of groups (2–8)",{"type":43,"tag":52,"props":555,"children":556},{},[557],{"type":49,"value":558},"Use a violin plot when you suspect groups differ not just in median but in shape — for example, one group is bimodal or heavily skewed. For more than ~10 groups, a ridgeline plot or faceted histogram is often cleaner.",{"type":43,"tag":44,"props":560,"children":562},{"id":561},"related-tools",[563],{"type":49,"value":564},"Related Tools",{"type":43,"tag":52,"props":566,"children":567},{},[568,570,576,577,583,585,591],{"type":49,"value":569},"Use the ",{"type":43,"tag":196,"props":571,"children":573},{"href":572},"/tools/t-test",[574],{"type":49,"value":575},"Online t-test calculator",{"type":49,"value":203},{"type":43,"tag":196,"props":578,"children":580},{"href":579},"/tools/one-way-anova",[581],{"type":49,"value":582},"ANOVA calculator",{"type":49,"value":584}," after visually exploring distributions with a violin plot — they'll test whether the differences you see are statistically significant. Use the ",{"type":43,"tag":196,"props":586,"children":588},{"href":587},"/tools/ai-histogram-generator",[589],{"type":49,"value":590},"AI Histogram Generator",{"type":49,"value":592}," to examine a single group's distribution in more detail.",{"type":43,"tag":44,"props":594,"children":596},{"id":595},"frequently-asked-questions",[597],{"type":49,"value":598},"Frequently Asked Questions",{"type":43,"tag":52,"props":600,"children":601},{},[602,607,609,615,617,623,625,631],{"type":43,"tag":58,"props":603,"children":604},{},[605],{"type":49,"value":606},"My violin has a strange flat edge at the top or bottom — is that a bug?",{"type":49,"value":608},"\nNo. Plotly and seaborn by default clip the KDE at the data's min/max, which creates a flat edge. You can ask the AI to use ",{"type":43,"tag":139,"props":610,"children":612},{"className":611},[],[613],{"type":49,"value":614},"cut=0",{"type":49,"value":616}," (seaborn) or ",{"type":43,"tag":139,"props":618,"children":620},{"className":619},[],[621],{"type":49,"value":622},"spanmode='hard'",{"type":49,"value":624}," (Plotly) to enforce this, or ",{"type":43,"tag":139,"props":626,"children":628},{"className":627},[],[629],{"type":49,"value":630},"cut=2",{"type":49,"value":632}," to extend the tails smoothly.",{"type":43,"tag":52,"props":634,"children":635},{},[636,641],{"type":43,"tag":58,"props":637,"children":638},{},[639],{"type":49,"value":640},"Can I show half-violins to save space?",{"type":49,"value":642},"\nYes — ask for a \"half violin\" or \"split violin\" plot. Split violins are especially useful for comparing two sub-groups (e.g. male vs. female) within each category by mirroring the two halves.",{"type":43,"tag":52,"props":644,"children":645},{},[646,651,653,659],{"type":43,"tag":58,"props":647,"children":648},{},[649],{"type":49,"value":650},"The violin for one of my groups looks like a thin line — why?",{"type":49,"value":652},"\nThat group likely has very few data points or very low variance, so the KDE collapses. Ask the AI to overlay the raw points for that group, or increase the KDE bandwidth (",{"type":43,"tag":139,"props":654,"children":656},{"className":655},[],[657],{"type":49,"value":658},"bw_method",{"type":49,"value":660}," in seaborn).",{"type":43,"tag":52,"props":662,"children":663},{},[664,669],{"type":43,"tag":58,"props":665,"children":666},{},[667],{"type":49,"value":668},"What's the difference between a violin plot and a ridgeline plot?",{"type":49,"value":670},"\nA ridgeline (joy) plot stacks KDE curves vertically and works better when you have many groups (10+). A violin plot mirrors the KDE and is better for direct side-by-side comparison of a smaller number of groups.",{"title":7,"searchDepth":672,"depth":672,"links":673},2,[674,675,676,677,678,679,680],{"id":46,"depth":672,"text":50},{"id":119,"depth":672,"text":122},{"id":214,"depth":672,"text":217},{"id":360,"depth":672,"text":363},{"id":473,"depth":672,"text":476},{"id":561,"depth":672,"text":564},{"id":595,"depth":672,"text":598},"markdown","content:tools:009.ai-violin-plot.md","content","tools/009.ai-violin-plot.md","tools/009.ai-violin-plot","md",{"loc":4},1775502468196]