[{"data":1,"prerenderedAt":779},["ShallowReactive",2],{"content-query-Xk0K0fYD71":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":17,"nav":17,"presets":18,"gallery":36,"body":38,"_type":772,"_id":773,"_source":774,"_file":775,"_stem":776,"_extension":777,"sitemap":778},"/tools/alluvial-diagram","tools",false,"","Alluvial Diagram Generator for Excel & CSV","Create alluvial diagrams online from Excel and CSV data. Show how groups, categories, or outcomes flow across stages with AI.","Alluvial Diagram Generator",{"prefix":12,"label":13,"placeholder":14},"Create an alluvial diagram","Describe the alluvial diagram you want to create","e.g. alluvial diagram of education level to employment sector to income bracket",[16],"charts",true,[19,25,31],{"label":20,"prompt":21,"dataset_url":22,"dataset_title":23,"dataset_citation":24},"Education to employment to income","alluvial diagram tracing how workforce populations flow from education level (no degree, high school, bachelor's, graduate) through employment sector (agriculture, manufacturing, services, tech, healthcare) to income bracket (low, middle, upper-middle, high); color flows by education level; use the most recent year of data","https://api.worldbank.org/v2/en/indicator/SL.TLF.ADVN.ZS?downloadformat=excel","Labor force with advanced education (% of total)","World Bank",{"label":26,"prompt":27,"dataset_url":28,"dataset_title":29,"dataset_citation":30},"Energy source to sector to region","alluvial diagram showing how primary energy flows from source type (fossil fuels, nuclear, renewables) through consumption sector (industry, transport, buildings, other) to world region; color by energy source; show the most recent decade","https://ourworldindata.org/grapher/primary-energy-source-bar.csv","Primary energy consumption by source","Our World in Data",{"label":32,"prompt":33,"dataset_url":34,"dataset_title":35,"dataset_citation":24},"Employment sector transitions","alluvial diagram showing how employment is distributed across agriculture, industry, and services sectors by World Bank income group (low, lower-middle, upper-middle, high); color flows by income group; label the widest flows","https://api.worldbank.org/v2/en/indicator/SL.AGR.EMPL.ZS?downloadformat=excel","Employment in agriculture (% of total employment)",[37],"/img/tools/alluvial-diagram.png",{"type":39,"children":40,"toc":762},"root",[41,50,85,97,116,122,186,192,200,284,292,377,382,388,522,528,636,642,671,677,701,718,728,745],{"type":42,"tag":43,"props":44,"children":46},"element","h2",{"id":45},"what-is-an-alluvial-diagram",[47],{"type":48,"value":49},"text","What Is an Alluvial Diagram?",{"type":42,"tag":51,"props":52,"children":53},"p",{},[54,56,62,64,69,71,76,78,83],{"type":48,"value":55},"An ",{"type":42,"tag":57,"props":58,"children":59},"strong",{},[60],{"type":48,"value":61},"alluvial diagram",{"type":48,"value":63}," is a type of flow chart that shows how observations, quantities, or populations ",{"type":42,"tag":57,"props":65,"children":66},{},[67],{"type":48,"value":68},"redistribute across multiple categorical stages",{"type":48,"value":70},". Each stage is represented as a column of stacked blocks (called ",{"type":42,"tag":57,"props":72,"children":73},{},[74],{"type":48,"value":75},"alluvia",{"type":48,"value":77},"), and smooth ribbon-shaped flows (called ",{"type":42,"tag":57,"props":79,"children":80},{},[81],{"type":48,"value":82},"lodes",{"type":48,"value":84},") connect matching categories between adjacent stages. The width of each ribbon is proportional to the number of observations or the size of the flow it represents.",{"type":42,"tag":51,"props":86,"children":87},{},[88,90,95],{"type":48,"value":89},"The key distinction from a regular Sankey diagram is that alluvial diagrams emphasize ",{"type":42,"tag":57,"props":91,"children":92},{},[93],{"type":48,"value":94},"change in categorical composition over time or across stages",{"type":48,"value":96}," — they answer questions like \"how did people with a high school diploma end up distributed across employment sectors, and where did those workers land in the income distribution?\" A classic use in social science is tracking cohort trajectories: starting from education level, flowing through occupation, and landing in an income bracket. In public health, researchers use them to show how patients diagnosed with one condition later develop comorbidities or respond to different treatment pathways. In energy policy, they map how primary energy sources feed into end-use sectors across different countries.",{"type":42,"tag":51,"props":98,"children":99},{},[100,102,107,109,114],{"type":48,"value":101},"Alluvial diagrams excel when you have ",{"type":42,"tag":57,"props":103,"children":104},{},[105],{"type":48,"value":106},"3–6 categorical stages",{"type":48,"value":108}," with ",{"type":42,"tag":57,"props":110,"children":111},{},[112],{"type":48,"value":113},"4–12 categories per stage",{"type":48,"value":115}," and want to see both the size of each category and how the mixture changes as you move through the stages. They are more informative than a series of pie charts (which show composition at each stage but hide the connections) and more readable than a matrix of transition tables.",{"type":42,"tag":43,"props":117,"children":119},{"id":118},"how-it-works",[120],{"type":48,"value":121},"How It Works",{"type":42,"tag":123,"props":124,"children":125},"ol",{},[126,151,167],{"type":42,"tag":127,"props":128,"children":129},"li",{},[130,135,137,142,144,149],{"type":42,"tag":57,"props":131,"children":132},{},[133],{"type":48,"value":134},"Upload your data",{"type":48,"value":136}," — provide a CSV or Excel file in one of two formats: (a) ",{"type":42,"tag":57,"props":138,"children":139},{},[140],{"type":48,"value":141},"long format",{"type":48,"value":143}," with one row per observation and one column per stage, or (b) ",{"type":42,"tag":57,"props":145,"children":146},{},[147],{"type":48,"value":148},"aggregated format",{"type":48,"value":150}," with columns for each pair of stages and a count/value column. The AI can handle both.",{"type":42,"tag":127,"props":152,"children":153},{},[154,159,161],{"type":42,"tag":57,"props":155,"children":156},{},[157],{"type":48,"value":158},"Describe the diagram",{"type":48,"value":160}," — e.g. ",{"type":42,"tag":162,"props":163,"children":164},"em",{},[165],{"type":48,"value":166},"\"alluvial diagram from education level through employment sector to income bracket, color flows by education, label nodes with counts\"",{"type":42,"tag":127,"props":168,"children":169},{},[170,175,177,184],{"type":42,"tag":57,"props":171,"children":172},{},[173],{"type":48,"value":174},"Get the visualization",{"type":48,"value":176}," — the AI writes Python code using ",{"type":42,"tag":178,"props":179,"children":181},"a",{"href":180},"https://plotly.com/python/sankey-diagram/",[182],{"type":48,"value":183},"Plotly",{"type":48,"value":185}," to build the multi-stage flow chart with colored ribbons and labeled nodes",{"type":42,"tag":43,"props":187,"children":189},{"id":188},"required-data-format",[190],{"type":48,"value":191},"Required Data Format",{"type":42,"tag":51,"props":193,"children":194},{},[195],{"type":42,"tag":57,"props":196,"children":197},{},[198],{"type":48,"value":199},"Long format (one row per observation):",{"type":42,"tag":201,"props":202,"children":203},"table",{},[204,233],{"type":42,"tag":205,"props":206,"children":207},"thead",{},[208],{"type":42,"tag":209,"props":210,"children":211},"tr",{},[212,218,223,228],{"type":42,"tag":213,"props":214,"children":215},"th",{},[216],{"type":48,"value":217},"person_id",{"type":42,"tag":213,"props":219,"children":220},{},[221],{"type":48,"value":222},"education",{"type":42,"tag":213,"props":224,"children":225},{},[226],{"type":48,"value":227},"sector",{"type":42,"tag":213,"props":229,"children":230},{},[231],{"type":48,"value":232},"income",{"type":42,"tag":234,"props":235,"children":236},"tbody",{},[237,261],{"type":42,"tag":209,"props":238,"children":239},{},[240,246,251,256],{"type":42,"tag":241,"props":242,"children":243},"td",{},[244],{"type":48,"value":245},"1",{"type":42,"tag":241,"props":247,"children":248},{},[249],{"type":48,"value":250},"Bachelor's",{"type":42,"tag":241,"props":252,"children":253},{},[254],{"type":48,"value":255},"Tech",{"type":42,"tag":241,"props":257,"children":258},{},[259],{"type":48,"value":260},"High",{"type":42,"tag":209,"props":262,"children":263},{},[264,269,274,279],{"type":42,"tag":241,"props":265,"children":266},{},[267],{"type":48,"value":268},"2",{"type":42,"tag":241,"props":270,"children":271},{},[272],{"type":48,"value":273},"High School",{"type":42,"tag":241,"props":275,"children":276},{},[277],{"type":48,"value":278},"Manufacturing",{"type":42,"tag":241,"props":280,"children":281},{},[282],{"type":48,"value":283},"Middle",{"type":42,"tag":51,"props":285,"children":286},{},[287],{"type":42,"tag":57,"props":288,"children":289},{},[290],{"type":48,"value":291},"Aggregated format (pre-counted flows):",{"type":42,"tag":201,"props":293,"children":294},{},[295,326],{"type":42,"tag":205,"props":296,"children":297},{},[298],{"type":42,"tag":209,"props":299,"children":300},{},[301,306,311,316,321],{"type":42,"tag":213,"props":302,"children":303},{},[304],{"type":48,"value":305},"from_stage",{"type":42,"tag":213,"props":307,"children":308},{},[309],{"type":48,"value":310},"from_category",{"type":42,"tag":213,"props":312,"children":313},{},[314],{"type":48,"value":315},"to_stage",{"type":42,"tag":213,"props":317,"children":318},{},[319],{"type":48,"value":320},"to_category",{"type":42,"tag":213,"props":322,"children":323},{},[324],{"type":48,"value":325},"count",{"type":42,"tag":234,"props":327,"children":328},{},[329,353],{"type":42,"tag":209,"props":330,"children":331},{},[332,336,340,344,348],{"type":42,"tag":241,"props":333,"children":334},{},[335],{"type":48,"value":222},{"type":42,"tag":241,"props":337,"children":338},{},[339],{"type":48,"value":250},{"type":42,"tag":241,"props":341,"children":342},{},[343],{"type":48,"value":227},{"type":42,"tag":241,"props":345,"children":346},{},[347],{"type":48,"value":255},{"type":42,"tag":241,"props":349,"children":350},{},[351],{"type":48,"value":352},"320",{"type":42,"tag":209,"props":354,"children":355},{},[356,360,364,368,372],{"type":42,"tag":241,"props":357,"children":358},{},[359],{"type":48,"value":227},{"type":42,"tag":241,"props":361,"children":362},{},[363],{"type":48,"value":255},{"type":42,"tag":241,"props":365,"children":366},{},[367],{"type":48,"value":232},{"type":42,"tag":241,"props":369,"children":370},{},[371],{"type":48,"value":260},{"type":42,"tag":241,"props":373,"children":374},{},[375],{"type":48,"value":376},"210",{"type":42,"tag":51,"props":378,"children":379},{},[380],{"type":48,"value":381},"If your data is in a different shape, describe the column layout in your prompt and the AI will reshape it.",{"type":42,"tag":43,"props":383,"children":385},{"id":384},"interpreting-the-results",[386],{"type":48,"value":387},"Interpreting the Results",{"type":42,"tag":201,"props":389,"children":390},{},[391,407],{"type":42,"tag":205,"props":392,"children":393},{},[394],{"type":42,"tag":209,"props":395,"children":396},{},[397,402],{"type":42,"tag":213,"props":398,"children":399},{},[400],{"type":48,"value":401},"Visual element",{"type":42,"tag":213,"props":403,"children":404},{},[405],{"type":48,"value":406},"What it means",{"type":42,"tag":234,"props":408,"children":409},{},[410,426,442,458,474,490,506],{"type":42,"tag":209,"props":411,"children":412},{},[413,421],{"type":42,"tag":241,"props":414,"children":415},{},[416],{"type":42,"tag":57,"props":417,"children":418},{},[419],{"type":48,"value":420},"Width of a block",{"type":42,"tag":241,"props":422,"children":423},{},[424],{"type":48,"value":425},"Total size of that category at that stage",{"type":42,"tag":209,"props":427,"children":428},{},[429,437],{"type":42,"tag":241,"props":430,"children":431},{},[432],{"type":42,"tag":57,"props":433,"children":434},{},[435],{"type":48,"value":436},"Width of a ribbon",{"type":42,"tag":241,"props":438,"children":439},{},[440],{"type":48,"value":441},"Number of observations flowing between those two categories",{"type":42,"tag":209,"props":443,"children":444},{},[445,453],{"type":42,"tag":241,"props":446,"children":447},{},[448],{"type":42,"tag":57,"props":449,"children":450},{},[451],{"type":48,"value":452},"Ribbon color",{"type":42,"tag":241,"props":454,"children":455},{},[456],{"type":48,"value":457},"Typically encodes the source category (e.g. education level)",{"type":42,"tag":209,"props":459,"children":460},{},[461,469],{"type":42,"tag":241,"props":462,"children":463},{},[464],{"type":42,"tag":57,"props":465,"children":466},{},[467],{"type":48,"value":468},"Ribbon splitting",{"type":42,"tag":241,"props":470,"children":471},{},[472],{"type":48,"value":473},"One category distributes into multiple downstream categories",{"type":42,"tag":209,"props":475,"children":476},{},[477,485],{"type":42,"tag":241,"props":478,"children":479},{},[480],{"type":42,"tag":57,"props":481,"children":482},{},[483],{"type":48,"value":484},"Ribbon merging",{"type":42,"tag":241,"props":486,"children":487},{},[488],{"type":48,"value":489},"Multiple upstream categories converge into one downstream category",{"type":42,"tag":209,"props":491,"children":492},{},[493,501],{"type":42,"tag":241,"props":494,"children":495},{},[496],{"type":42,"tag":57,"props":497,"children":498},{},[499],{"type":48,"value":500},"Thick ribbon between two nodes",{"type":42,"tag":241,"props":502,"children":503},{},[504],{"type":48,"value":505},"Strong association between those two categories",{"type":42,"tag":209,"props":507,"children":508},{},[509,517],{"type":42,"tag":241,"props":510,"children":511},{},[512],{"type":42,"tag":57,"props":513,"children":514},{},[515],{"type":48,"value":516},"Thin scattered ribbons",{"type":42,"tag":241,"props":518,"children":519},{},[520],{"type":48,"value":521},"Weak or diffuse association — flow spreads evenly across categories",{"type":42,"tag":43,"props":523,"children":525},{"id":524},"example-prompts",[526],{"type":48,"value":527},"Example Prompts",{"type":42,"tag":201,"props":529,"children":530},{},[531,547],{"type":42,"tag":205,"props":532,"children":533},{},[534],{"type":42,"tag":209,"props":535,"children":536},{},[537,542],{"type":42,"tag":213,"props":538,"children":539},{},[540],{"type":48,"value":541},"Scenario",{"type":42,"tag":213,"props":543,"children":544},{},[545],{"type":48,"value":546},"What to type",{"type":42,"tag":234,"props":548,"children":549},{},[550,568,585,602,619],{"type":42,"tag":209,"props":551,"children":552},{},[553,558],{"type":42,"tag":241,"props":554,"children":555},{},[556],{"type":48,"value":557},"Social mobility",{"type":42,"tag":241,"props":559,"children":560},{},[561],{"type":42,"tag":562,"props":563,"children":565},"code",{"className":564},[],[566],{"type":48,"value":567},"alluvial diagram from parents' income to child's education to child's income, color by parental income",{"type":42,"tag":209,"props":569,"children":570},{},[571,576],{"type":42,"tag":241,"props":572,"children":573},{},[574],{"type":48,"value":575},"Patient pathways",{"type":42,"tag":241,"props":577,"children":578},{},[579],{"type":42,"tag":562,"props":580,"children":582},{"className":581},[],[583],{"type":48,"value":584},"alluvial diagram from diagnosis to treatment type to outcome, show patient counts per flow",{"type":42,"tag":209,"props":586,"children":587},{},[588,593],{"type":42,"tag":241,"props":589,"children":590},{},[591],{"type":48,"value":592},"Energy transition",{"type":42,"tag":241,"props":594,"children":595},{},[596],{"type":42,"tag":562,"props":597,"children":599},{"className":598},[],[600],{"type":48,"value":601},"alluvial from energy source to consumption sector to world region, color by source type",{"type":42,"tag":209,"props":603,"children":604},{},[605,610],{"type":42,"tag":241,"props":606,"children":607},{},[608],{"type":48,"value":609},"Workforce shifts",{"type":42,"tag":241,"props":611,"children":612},{},[613],{"type":42,"tag":562,"props":614,"children":616},{"className":615},[],[617],{"type":48,"value":618},"alluvial diagram of employment by sector in 2000 vs 2010 vs 2020, show how shares changed",{"type":42,"tag":209,"props":620,"children":621},{},[622,627],{"type":42,"tag":241,"props":623,"children":624},{},[625],{"type":48,"value":626},"Survey data",{"type":42,"tag":241,"props":628,"children":629},{},[630],{"type":42,"tag":562,"props":631,"children":633},{"className":632},[],[634],{"type":48,"value":635},"alluvial from age group to political affiliation to voting behavior, label widest flows",{"type":42,"tag":43,"props":637,"children":639},{"id":638},"related-tools",[640],{"type":48,"value":641},"Related Tools",{"type":42,"tag":51,"props":643,"children":644},{},[645,647,653,655,661,663,669],{"type":48,"value":646},"Use the ",{"type":42,"tag":178,"props":648,"children":650},{"href":649},"/tools/ai-sankey-diagram",[651],{"type":48,"value":652},"AI Sankey Diagram Generator",{"type":48,"value":654}," when you want to show directed quantities flowing through a network without emphasizing categorical stages — for example, energy balance flows or budget allocations. Use the ",{"type":42,"tag":178,"props":656,"children":658},{"href":657},"/tools/ternary-plot",[659],{"type":48,"value":660},"Ternary Plot Generator",{"type":48,"value":662}," when your data always has exactly three compositional components summing to 100%. Use the ",{"type":42,"tag":178,"props":664,"children":666},{"href":665},"/tools/ai-heatmap",[667],{"type":48,"value":668},"AI Heatmap Generator",{"type":48,"value":670}," to compare association strengths between two categorical variables across many combinations without emphasizing the flow direction.",{"type":42,"tag":43,"props":672,"children":674},{"id":673},"frequently-asked-questions",[675],{"type":48,"value":676},"Frequently Asked Questions",{"type":42,"tag":51,"props":678,"children":679},{},[680,685,687,692,694,699],{"type":42,"tag":57,"props":681,"children":682},{},[683],{"type":48,"value":684},"What is the difference between an alluvial diagram and a Sankey diagram?",{"type":48,"value":686},"\nBoth use ribbon-width to encode flow size, but they serve different purposes. An alluvial diagram tracks how a ",{"type":42,"tag":57,"props":688,"children":689},{},[690],{"type":48,"value":691},"fixed population",{"type":48,"value":693}," redistributes across categorical stages — each observation belongs to exactly one category at each stage, and the total width stays constant across all stages. A Sankey diagram shows ",{"type":42,"tag":57,"props":695,"children":696},{},[697],{"type":48,"value":698},"directed quantities flowing through a network",{"type":48,"value":700},", where totals can change (e.g. energy is lost to heat, budgets split unevenly). Use alluvial for cohort tracking; use Sankey for flow accounting.",{"type":42,"tag":51,"props":702,"children":703},{},[704,709,711,716],{"type":42,"tag":57,"props":705,"children":706},{},[707],{"type":48,"value":708},"My data is one row per observation with a column for each stage — does that work?",{"type":48,"value":710},"\nYes — this is the ideal long format. Describe the column names in your prompt (e.g. ",{"type":42,"tag":162,"props":712,"children":713},{},[714],{"type":48,"value":715},"\"columns are: respondent_id, education, occupation, income_bracket\"",{"type":48,"value":717},") and the AI will count the flows between stages automatically before building the diagram.",{"type":42,"tag":51,"props":719,"children":720},{},[721,726],{"type":42,"tag":57,"props":722,"children":723},{},[724],{"type":48,"value":725},"How many stages and categories can I include?",{"type":48,"value":727},"\nAlluvial diagrams work best with 3–6 stages and 4–12 categories per stage. More stages make the horizontal span too wide; more categories per stage make the ribbons too thin to read. If you have many categories, ask the AI to group rare ones into an \"Other\" category or to show only the top N by volume.",{"type":42,"tag":51,"props":729,"children":730},{},[731,736,738,743],{"type":42,"tag":57,"props":732,"children":733},{},[734],{"type":48,"value":735},"Can I show change over time rather than a conceptual pipeline?",{"type":48,"value":737},"\nYes — each time point becomes a stage. For example, ",{"type":42,"tag":162,"props":739,"children":740},{},[741],{"type":48,"value":742},"\"alluvial diagram showing employment by sector in 1990, 2000, 2010, and 2020 for OECD countries\"",{"type":48,"value":744}," will produce four columns with ribbons showing how the sector mix shifted decade by decade.",{"type":42,"tag":51,"props":746,"children":747},{},[748,753,755,760],{"type":42,"tag":57,"props":749,"children":750},{},[751],{"type":48,"value":752},"Can I color the ribbons by destination category instead of source?",{"type":48,"value":754},"\nYes — ask to ",{"type":42,"tag":162,"props":756,"children":757},{},[758],{"type":48,"value":759},"\"color ribbons by income bracket\"",{"type":48,"value":761}," (the final stage) instead of the default source coloring. You can also ask for a gradient (source color on the left side of each ribbon fading to destination color on the right) for a more sophisticated look.",{"title":7,"searchDepth":763,"depth":763,"links":764},2,[765,766,767,768,769,770,771],{"id":45,"depth":763,"text":49},{"id":118,"depth":763,"text":121},{"id":188,"depth":763,"text":191},{"id":384,"depth":763,"text":387},{"id":524,"depth":763,"text":527},{"id":638,"depth":763,"text":641},{"id":673,"depth":763,"text":676},"markdown","content:tools:017.alluvial-diagram.md","content","tools/017.alluvial-diagram.md","tools/017.alluvial-diagram","md",{"loc":4},1775502468196]