[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECP0GQQES3S5ZXAG8KAX0S":3,"skill-same:01M7ECP0GQQES3S5ZXAG8KAX0S":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7ECP0GQQES3S5ZXAG8KAX0S","bio-data-visualization-flow-and-transition-plots",null,"Build Sankey, alluvial, river, and CONSORT-style flow diagrams to visualize cohort transitions, cell-state changes, or pipeline filtering using ggalluvial, networkD3, plotly, and consort. Use when showing how entities move between categories across timepoints (cell states, drug response classes, patient flow through a trial) or filtering pipelines (variants filtered through QC stages).","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-flow-and-transition-plots\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-data-visualization-flow-and-transition-plots\ndescription: Build Sankey, alluvial, river, and CONSORT-style flow diagrams to visualize cohort transitions, cell-state changes, or pipeline filtering using ggalluvial, networkD3, plotly, and consort. Use when showing how entities move between categories across timepoints (cell states, drug response classes, patient flow through a trial) or filtering pipelines (variants filtered through QC stages).\ntool_type: mixed\nprimary_tool: ggalluvial\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"data-visualization\u002Fflow-and-transition-plots\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: ggalluvial 0.12+, networkD3 0.4+, plotly 4.10+, consort 0.2+ (CONSORT diagrams), pySankey 0.0.1+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n- Python: `pip show \u003Cpackage>` then `help(module.function)`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Flow and Transition Plots\n\n**\"Show how things flow between categories\"** -> Render entities as ribbons whose width encodes count, flowing between ordered columns of categories. Sankey emphasizes total flow magnitude; alluvial emphasizes per-entity continuity (each row's path is traceable); CONSORT formalizes the trial-filtering convention. The decision space: which method (Sankey vs alluvial vs CONSORT), how to order categories within each column, and whether to highlight specific entity trajectories.\n\n- R: `ggalluvial::geom_alluvium`, `networkD3::sankeyNetwork`, `consort::consort_plot`\n- Python: `plotly.graph_objects.Sankey`, `pySankey`\n\n## The Single Most Important Modern Insight -- Sankey vs Alluvial Are Different\n\n**Sankey** plots show flow from sources to sinks; each ribbon represents an aggregate count. The horizontal direction is \"flow.\" Use for energy flows, web-traffic funnels, cohort dropouts.\n\n**Alluvial** plots track *individual entities* through multiple ordered category columns (axes). Each row of input data becomes a continuous ribbon; intersections at each axis show counts in each category. Use for cell-state transitions across timepoints, drug-response trajectories, longitudinal class changes.\n\nA Sankey shows \"100 cells became neuron, 50 became glia\"; an alluvial shows \"of the 100 that became neurons at t2, 80 came from the proliferating pool at t1.\" Different encoding, different scientific story.\n\n## Decision Tree by Use Case\n\n| Use case | Recommended | Tool |\n|----------|-------------|------|\n| Single timepoint, source-to-sink flow | Sankey | networkD3, plotly |\n| Multi-timepoint entity trajectories | Alluvial | ggalluvial |\n| Clinical trial patient flow | CONSORT (formal vertical box-and-arrow) | consort R package |\n| Variant filtering pipeline | CONSORT-style flow | consort or manual diagrammeR |\n| Cell-state transitions (scRNA timepoints) | Alluvial OR Sankey if 2 timepoints | ggalluvial |\n| Drug response class changes | Alluvial | ggalluvial |\n| Gene-set membership across conditions | UpSet (alternative) | data-visualization\u002Fupset-plots |\n\n## ggalluvial -- Modern R Default for Alluvial\n\n**Goal:** Visualize entity (e.g., cell, patient) trajectories across multiple ordered axes with ribbon-width = count.\n\n**Approach:** Reshape to \"lodes\" (long) format with one row per entity-stratum, or \"alluvia\" (wide) format with one row per entity; use `geom_alluvium` for ribbons and `geom_stratum` for column boxes.\n\n```r\nlibrary(ggalluvial)\nlibrary(ggplot2)\n\n# Wide (alluvia) format: one row per entity\ndf_wide \u003C- data.frame(\n    entity_id = 1:1000,\n    t1 = sample(c('A', 'B', 'C'), 1000, replace = TRUE),\n    t2 = sample(c('A', 'B', 'C'), 1000, replace = TRUE),\n    t3 = sample(c('A', 'B', 'C'), 1000, replace = TRUE))\n\nggplot(df_wide, aes(axis1 = t1, axis2 = t2, axis3 = t3)) +\n    geom_alluvium(aes(fill = t1), alpha = 0.7, width = 1\u002F6) +\n    geom_stratum(width = 1\u002F6, fill = 'grey90', color = 'black') +\n    geom_text(stat = 'stratum', aes(label = after_stat(stratum)), size = 3) +\n    scale_x_discrete(limits = c('t1', 't2', 't3')) +\n    scale_fill_manual(values = c('#0072B2', '#D55E00', '#009E73')) +\n    labs(y = 'Entities', x = NULL) +\n    theme_classic()\n```\n\n`aes(fill = t1)` colors each ribbon by its starting class — common pattern for \"where did this end up cluster come from?\" stories.\n\n## networkD3 -- Interactive Sankey\n\n```r\nlibrary(networkD3)\n\n# Nodes and links\nnodes \u003C- data.frame(name = c('Source A', 'Source B', 'Sink X', 'Sink Y', 'Sink Z'))\nlinks \u003C- data.frame(source = c(0, 0, 1, 1),\n                    target = c(2, 3, 3, 4),\n                    value  = c(40, 30, 50, 20))\n\nsankeyNetwork(Links = links, Nodes = nodes,\n              Source = 'source', Target = 'target', Value = 'value',\n              NodeID = 'name',\n              colourScale = JS('d3.scaleOrdinal(d3.schemeCategory10);'),\n              fontSize = 12, nodeWidth = 30, height = 400, width = 700)\n```\n\nnetworkD3 produces interactive HTML — drag nodes, hover for values. For static publication figure, screenshot or export via `webshot2`.\n\n## plotly Sankey (Python)\n\n```python\nimport plotly.graph_objects as go\n\nfig = go.Figure(go.Sankey(\n    node=dict(label=['Source A', 'Source B', 'Sink X', 'Sink Y', 'Sink Z'],\n              color=['#0072B2', '#56B4E9', '#D55E00', '#E69F00', '#009E73']),\n    link=dict(source=[0, 0, 1, 1],\n              target=[2, 3, 3, 4],\n              value=[40, 30, 50, 20],\n              color=['rgba(0,114,178,0.4)'] * 4)))\nfig.update_layout(title='Flow', font_size=12)\nfig.write_html('sankey.html')\nfig.write_image('sankey.pdf')           # requires Kaleido (NOT orca; orca is EOL)\n```\n\n## CONSORT Diagrams -- The Formal Trial-Flow Standard\n\nCONSORT 2010 (Schulz 2010 *BMJ* 340:c332) is the canonical clinical-trial flow diagram. The `consort` R package implements the structure:\n\n```r\nlibrary(consort)\n\n# Trial enrollment flow\ng \u003C- add_box(txt = c('Assessed for eligibility (n=200)'))\ng \u003C- add_side_box(g, txt = c('Excluded (n=50)\\n  - Not meeting criteria (n=30)\\n  - Declined (n=15)\\n  - Other (n=5)'))\ng \u003C- add_box(g, txt = c('Randomized (n=150)'))\ng \u003C- add_split(g, txt = c('Allocated to intervention (n=75)\\n  - Received as allocated (n=70)\\n  - Did not receive (n=5)',\n                          'Allocated to control (n=75)\\n  - Received as allocated (n=73)\\n  - Did not receive (n=2)'))\ng \u003C- add_box(g, txt = c('Lost to follow-up (n=2)\\nDiscontinued (n=3)',\n                        'Lost to follow-up (n=1)\\nDiscontinued (n=2)'))\ng \u003C- add_box(g, txt = c('Analysed (n=75)\\nExcluded from analysis (n=0)',\n                        'Analysed (n=75)\\nExcluded from analysis (n=0)'))\nplot(g)\n```\n\nCONSORT is a *required* element in randomized trial publication (CONSORT 2010 statement, item 13a).\n\n## Per-Method Failure Modes\n\n### Sankey used when alluvial is appropriate\n\n**Trigger:** Multi-timepoint cell-state data plotted as Sankey instead of alluvial.\n\n**Mechanism:** Sankey collapses to source-sink summary; loses entity-trajectory continuity.\n\n**Symptom:** Reader sees \"cluster A -> 50% to B, 50% to C\" but cannot trace individual trajectories.\n\n**Fix:** Use ggalluvial for multi-axis trajectories; Sankey for single-step source-to-sink.\n\n### Category ordering within column not specified\n\n**Trigger:** Default ggalluvial ordering by frequency.\n\n**Mechanism:** Categories shuffle position across columns; ribbons cross excessively.\n\n**Symptom:** Visual spaghetti; hard to follow.\n\n**Fix:** Set explicit factor levels (`factor(t1, levels = c('A', 'B', 'C'))`) AND consider ggalluvial's `lode.guidance` to minimize crossings.\n\n### Ribbon coloring by destination instead of origin\n\n**Trigger:** `geom_alluvium(aes(fill = t3))` for a \"where did these come from\" story.\n\n**Mechanism:** Color encodes the wrong axis; readers misinterpret.\n\n**Symptom:** Story is \"where did final cluster Z come from\" but ribbons are colored by Z — every ribbon to Z is the same color.\n\n**Fix:** `aes(fill = t1)` if origin matters; `aes(fill = t3)` if destination matters.\n\n### CONSORT diagram missing required boxes\n\n**Trigger:** Skipping \"Lost to follow-up\" or \"Excluded from analysis\" boxes.\n\n**Mechanism:** CONSORT 2010 requires reporting at each stage.\n\n**Symptom:** Submission flagged for non-compliance with CONSORT 2010 item 13a.\n\n**Fix:** Use `consort` package which scaffolds the required structure; cross-check against CONSORT 2010 statement.\n\n### plotly Sankey value sum mismatch\n\n**Trigger:** Source-to-target sums don't balance.\n\n**Mechanism:** plotly Sankey requires conservation: sum of in-flows = sum of out-flows at each non-terminal node.\n\n**Symptom:** Layout renders but node sizes look wrong; ribbons stretch\u002Fcompress incorrectly.\n\n**Fix:** Verify upstream data: per-node `sum(value where target=node) == sum(value where source=node)` for internal nodes.\n\n### Static export of plotly Sankey fails silently\n\n**Trigger:** `fig.write_image('sankey.pdf')` without kaleido installed.\n\n**Mechanism:** plotly defaults to Kaleido for static export since orca EOL; kaleido is optional dependency.\n\n**Symptom:** No file written; no error in some plotly versions.\n\n**Fix:** `pip install kaleido`; verify with `import kaleido`.\n\n## Reconciliation: When Implementations Differ\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| ggalluvial and networkD3 show different orderings | Different default stratum\u002Fnode ordering | Set explicit factor levels \u002F node order |\n| CONSORT box counts don't sum | Box-content arithmetic error | Audit each box; consort package enforces structure |\n| Cells appear\u002Fdisappear between alluvial axes | Missing data in some timepoints | Decide: drop entities with NA; OR add \"Missing\" category |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| Max categories per column for legibility | 5-7 | Visualization practical |\n| Max axes for alluvial | 4-5 | Above this ribbons too crossed |\n| CONSORT requirement | Required for RCTs | Schulz 2010 CONSORT 2010 |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Excessive ribbon crossing | Categories unordered | Explicit factor levels; lode.guidance |\n| Trajectories not traceable | Sankey used instead of alluvial | Switch to ggalluvial |\n| CONSORT non-compliant | Missing required boxes | Use consort package |\n| Sankey node sizes wrong | Flow not conserved | Audit source-target sums |\n| plotly static export blank | kaleido not installed | `pip install kaleido` |\n| Color story unclear | Wrong axis for fill | Decide origin vs destination story |\n\n## References\n\n- Brunson J. 2020. ggalluvial: Layered grammar for alluvial plots. *J Open Source Softw* 5(49):2017.\n- Sankey MH. 1898. The thermal efficiency of steam engines. *Proc Inst Civil Eng* 134:278-312. (origin)\n- Schulz KF, Altman DG, Moher D; CONSORT Group. 2010. CONSORT 2010 Statement: updated guidelines for reporting parallel group randomised trials. *BMJ* 340:c332.\n- Riehmann P, Hanfler M, Froehlich B. 2005. Interactive Sankey diagrams. *IEEE Symp Information Visualization*.\n\n## Related Skills\n\n- data-visualization\u002Fupset-plots - Alternative for set-intersection rather than flow\n- clinical-biostatistics\u002Ftrial-reporting - CONSORT diagrams in trial publication\n- single-cell\u002Ftrajectory-inference - Cell-state transition data for alluvial\n- workflows\u002Fbiomarker-pipeline - Pipeline filtering flows\n","## Version Compatibility\n\nReference examples tested with: ggalluvial 0.12+, networkD3 0.4+, plotly 4.10+, consort 0.2+ (CONSORT diagrams), pySankey 0.0.1+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n- Python: `pip show \u003Cpackage>` then `help(module.function)`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Flow and Transition Plots\n\n**\"Show how things flow between categories\"** -> Render entities as ribbons whose width encodes count, flowing between ordered columns of categories. Sankey emphasizes total flow magnitude; alluvial emphasizes per-entity continuity (each row's path is traceable); CONSORT formalizes the trial-filtering convention. The decision space: which method (Sankey vs alluvial vs CONSORT), how to order categories within each column, and whether to highlight specific entity trajectories.\n\n- R: `ggalluvial::geom_alluvium`, `networkD3::sankeyNetwork`, `consort::consort_plot`\n- Python: `plotly.graph_objects.Sankey`, `pySankey`\n\n## The Single Most Important Modern Insight -- Sankey vs Alluvial Are Different\n\n**Sankey** plots show flow from sources to sinks; each ribbon represents an aggregate count. The horizontal direction is \"flow.\" Use for energy flows, web-traffic funnels, cohort dropouts.\n\n**Alluvial** plots track *individual entities* through multiple ordered category columns (axes). Each row of input data becomes a continuous ribbon; intersections at each axis show counts in each category. Use for cell-state transitions across timepoints, drug-response trajectories, longitudinal class changes.\n\nA Sankey shows \"100 cells became neuron, 50 became glia\"; an alluvial shows \"of the 100 that became neurons at t2, 80 came from the proliferating pool at t1.\" Different encoding, different scientific story.\n\n## Decision Tree by Use Case\n\n| Use case | Recommended | Tool |\n|----------|-------------|------|\n| Single timepoint, source-to-sink flow | Sankey | networkD3, plotly |\n| Multi-timepoint entity trajectories | Alluvial | ggalluvial |\n| Clinical trial patient flow | CONSORT (formal vertical box-and-arrow) | consort R package |\n| Variant filtering pipeline | CONSORT-style flow | consort or manual diagrammeR |\n| Cell-state transitions (scRNA timepoints) | Alluvial OR Sankey if 2 timepoints | ggalluvial |\n| Drug response class changes | Alluvial | ggalluvial |\n| Gene-set membership across conditions | UpSet (alternative) | data-visualization\u002Fupset-plots |\n\n## ggalluvial -- Modern R Default for Alluvial\n\n**Goal:** Visualize entity (e.g., cell, patient) trajectories across multiple ordered axes with ribbon-width = count.\n\n**Approach:** Reshape to \"lodes\" (long) format with one row per entity-stratum, or \"alluvia\" (wide) format with one row per entity; use `geom_alluvium` for ribbons and `geom_stratum` for column boxes.\n\n```r\nlibrary(ggalluvial)\nlibrary(ggplot2)\n\n# Wide (alluvia) format: one row per entity\ndf_wide \u003C- data.frame(\n    entity_id = 1:1000,\n    t1 = sample(c('A', 'B', 'C'), 1000, replace = TRUE),\n    t2 = sample(c('A', 'B', 'C'), 1000, replace = TRUE),\n    t3 = sample(c('A', 'B', 'C'), 1000, replace = TRUE))\n\nggplot(df_wide, aes(axis1 = t1, axis2 = t2, axis3 = t3)) +\n    geom_alluvium(aes(fill = t1), alpha = 0.7, width = 1\u002F6) +\n    geom_stratum(width = 1\u002F6, fill = 'grey90', color = 'black') +\n    geom_text(stat = 'stratum', aes(label = after_stat(stratum)), size = 3) +\n    scale_x_discrete(limits = c('t1', 't2', 't3')) +\n    scale_fill_manual(values = c('#0072B2', '#D55E00', '#009E73')) +\n    labs(y = 'Entities', x = NULL) +\n    theme_classic()\n```\n\n`aes(fill = t1)` colors each ribbon by its starting class — common pattern for \"where did this end up cluster come from?\" stories.\n\n## networkD3 -- Interactive Sankey\n\n```r\nlibrary(networkD3)\n\n# Nodes and links\nnodes \u003C- data.frame(name = c('Source A', 'Source B', 'Sink X', 'Sink Y', 'Sink Z'))\nlinks \u003C- data.frame(source = c(0, 0, 1, 1),\n                    target = c(2, 3, 3, 4),\n                    value  = c(40, 30, 50, 20))\n\nsankeyNetwork(Links = links, Nodes = nodes,\n              Source = 'source', Target = 'target', Value = 'value',\n              NodeID = 'name',\n              colourScale = JS('d3.scaleOrdinal(d3.schemeCategory10);'),\n              fontSize = 12, nodeWidth = 30, height = 400, width = 700)\n```\n\nnetworkD3 produces interactive HTML — drag nodes, hover for values. For static publication figure, screenshot or export via `webshot2`.\n\n## plotly Sankey (Python)\n\n```python\nimport plotly.graph_objects as go\n\nfig = go.Figure(go.Sankey(\n    node=dict(label=['Source A', 'Source B', 'Sink X', 'Sink Y', 'Sink Z'],\n              color=['#0072B2', '#56B4E9', '#D55E00', '#E69F00', '#009E73']),\n    link=dict(source=[0, 0, 1, 1],\n              target=[2, 3, 3, 4],\n              value=[40, 30, 50, 20],\n              color=['rgba(0,114,178,0.4)'] * 4)))\nfig.update_layout(title='Flow', font_size=12)\nfig.write_html('sankey.html')\nfig.write_image('sankey.pdf')           # requires Kaleido (NOT orca; orca is EOL)\n```\n\n## CONSORT Diagrams -- The Formal Trial-Flow Standard\n\nCONSORT 2010 (Schulz 2010 *BMJ* 340:c332) is the canonical clinical-trial flow diagram. The `consort` R package implements the structure:\n\n```r\nlibrary(consort)\n\n# Trial enrollment flow\ng \u003C- add_box(txt = c('Assessed for eligibility (n=200)'))\ng \u003C- add_side_box(g, txt = c('Excluded (n=50)\\n  - Not meeting criteria (n=30)\\n  - Declined (n=15)\\n  - Other (n=5)'))\ng \u003C- add_box(g, txt = c('Randomized (n=150)'))\ng \u003C- add_split(g, txt = c('Allocated to intervention (n=75)\\n  - Received as allocated (n=70)\\n  - Did not receive (n=5)',\n                          'Allocated to control (n=75)\\n  - Received as allocated (n=73)\\n  - Did not receive (n=2)'))\ng \u003C- add_box(g, txt = c('Lost to follow-up (n=2)\\nDiscontinued (n=3)',\n                        'Lost to follow-up (n=1)\\nDiscontinued (n=2)'))\ng \u003C- add_box(g, txt = c('Analysed (n=75)\\nExcluded from analysis (n=0)',\n                        'Analysed (n=75)\\nExcluded from analysis (n=0)'))\nplot(g)\n```\n\nCONSORT is a *required* element in randomized trial publication (CONSORT 2010 statement, item 13a).\n\n## Per-Method Failure Modes\n\n### Sankey used when alluvial is appropriate\n\n**Trigger:** Multi-timepoint cell-state data plotted as Sankey instead of alluvial.\n\n**Mechanism:** Sankey collapses to source-sink summary; loses entity-trajectory continuity.\n\n**Symptom:** Reader sees \"cluster A -> 50% to B, 50% to C\" but cannot trace individual trajectories.\n\n**Fix:** Use ggalluvial for multi-axis trajectories; Sankey for single-step source-to-sink.\n\n### Category ordering within column not specified\n\n**Trigger:** Default ggalluvial ordering by frequency.\n\n**Mechanism:** Categories shuffle position across columns; ribbons cross excessively.\n\n**Symptom:** Visual spaghetti; hard to follow.\n\n**Fix:** Set explicit factor levels (`factor(t1, levels = c('A', 'B', 'C'))`) AND consider ggalluvial's `lode.guidance` to minimize crossings.\n\n### Ribbon coloring by destination instead of origin\n\n**Trigger:** `geom_alluvium(aes(fill = t3))` for a \"where did these come from\" story.\n\n**Mechanism:** Color encodes the wrong axis; readers misinterpret.\n\n**Symptom:** Story is \"where did final cluster Z come from\" but ribbons are colored by Z — every ribbon to Z is the same color.\n\n**Fix:** `aes(fill = t1)` if origin matters; `aes(fill = t3)` if destination matters.\n\n### CONSORT diagram missing required boxes\n\n**Trigger:** Skipping \"Lost to follow-up\" or \"Excluded from analysis\" boxes.\n\n**Mechanism:** CONSORT 2010 requires reporting at each stage.\n\n**Symptom:** Submission flagged for non-compliance with CONSORT 2010 item 13a.\n\n**Fix:** Use `consort` package which scaffolds the required structure; cross-check against CONSORT 2010 statement.\n\n### plotly Sankey value sum mismatch\n\n**Trigger:** Source-to-target sums don't balance.\n\n**Mechanism:** plotly Sankey requires conservation: sum of in-flows = sum of out-flows at each non-terminal node.\n\n**Symptom:** Layout renders but node sizes look wrong; ribbons stretch\u002Fcompress incorrectly.\n\n**Fix:** Verify upstream data: per-node `sum(value where target=node) == sum(value where source=node)` for internal nodes.\n\n### Static export of plotly Sankey fails silently\n\n**Trigger:** `fig.write_image('sankey.pdf')` without kaleido installed.\n\n**Mechanism:** plotly defaults to Kaleido for static export since orca EOL; kaleido is optional dependency.\n\n**Symptom:** No file written; no error in some plotly versions.\n\n**Fix:** `pip install kaleido`; verify with `import kaleido`.\n\n## Reconciliation: When Implementations Differ\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| ggalluvial and networkD3 show different orderings | Different default stratum\u002Fnode ordering | Set explicit factor levels \u002F node order |\n| CONSORT box counts don't sum | Box-content arithmetic error | Audit each box; consort package enforces structure |\n| Cells appear\u002Fdisappear between alluvial axes | Missing data in some timepoints | Decide: drop entities with NA; OR add \"Missing\" category |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| Max categories per column for legibility | 5-7 | Visualization practical |\n| Max axes for alluvial | 4-5 | Above this ribbons too crossed |\n| CONSORT requirement | Required for RCTs | Schulz 2010 CONSORT 2010 |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Excessive ribbon crossing | Categories unordered | Explicit factor levels; lode.guidance |\n| Trajectories not traceable | Sankey used instead of alluvial | Switch to ggalluvial |\n| CONSORT non-compliant | Missing required boxes | Use consort package |\n| Sankey node sizes wrong | Flow not conserved | Audit source-target sums |\n| plotly static export blank | kaleido not installed | `pip install kaleido` |\n| Color story unclear | Wrong axis for fill | Decide origin vs destination story |\n\n## References\n\n- Brunson J. 2020. ggalluvial: Layered grammar for alluvial plots. *J Open Source Softw* 5(49):2017.\n- Sankey MH. 1898. The thermal efficiency of steam engines. *Proc Inst Civil Eng* 134:278-312. (origin)\n- Schulz KF, Altman DG, Moher D; CONSORT Group. 2010. CONSORT 2010 Statement: updated guidelines for reporting parallel group randomised trials. *BMJ* 340:c332.\n- Riehmann P, Hanfler M, Froehlich B. 2005. Interactive Sankey diagrams. *IEEE Symp Information Visualization*.\n\n## Related Skills\n\n- data-visualization\u002Fupset-plots - Alternative for set-intersection rather than flow\n- clinical-biostatistics\u002Ftrial-reporting - CONSORT diagrams in trial publication\n- single-cell\u002Ftrajectory-inference - Cell-state transition data for alluvial\n- workflows\u002Fbiomarker-pipeline - Pipeline filtering flows\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","mixed","2026-09-20","data-visualization\u002Fflow-and-transition-plots\u002FSKILL.md","ggalluvial","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-data-visualization-flow-and-transition-plots","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-flow-and-transition-plots",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-flow-and-transition-plots",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-flow-and-transition-plots","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-flow-and-transition-plots\u002FSKILL.md",true,[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Falluvial_phd.R","OTHER","其他",4124,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-flow-and-transition-plots\u002Fexamples\u002Falluvial_phd.R",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"usage-guide.md","REFERENCE","参考文档",4237,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-flow-and-transition-plots\u002Fusage-guide.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":70},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":70},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":70},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":70},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":70},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]