[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-657211-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-657211-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","create-sankey-and-alluvial-diagrams-using-ggplot2-package-documentation","Create Sankey and Alluvial Diagrams Using 'ggplot2' - Package Documentation","","ggsankeyfier is an R package for creating Sankey and alluvial diagrams that visualize flows of quantities across stages using stacked-bar ideas. It includes geoms and statistics for drawing nodes and edges, support for legend key glyphs, and helper functions for positioning and scaling. The accompanying ecosystem_services dataset provides example risk pathways affecting the capacity to supply ecosystem services, designed to be pivoted for Sankey plotting.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/create-sankey-and-alluvial-diagrams-using-ggplot2-package-documentation/657211/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/create-sankey-and-alluvial-diagrams-using-ggplot2-package-documentation/657211.png","ImageObject",300,407,{"name":42,"@type":43},"Cart","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-28","2026-10-26",true,{"@type":52,"interactionType":53,"userInteractionCount":26},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What problem does ggsankeyfier solve?","Question",{"text":62,"@type":63},"It visualizes flows of quantities across stages in Sankey and alluvial diagrams, making it easy to create such diagrams with ggplot2.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How are legend key glyphs handled in this package?",{"text":67,"@type":63},"Each relevant geom has an associated draw_key_* function (e.g., draw_key_sankeyedge, draw_key_sankeynode) that returns a grid grob and can be customized via the key_glyph argument.",{"name":69,"@type":60,"acceptedAnswer":70},"Why isn’t the ecosystem_services dataset directly plottable as a Sankey diagram?",{"text":71,"@type":63},"In its current wide format, it represents pathways in a way that requires pivoting with pivot_stages_longer() before producing a Sankey layout.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},657211,1793030523,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":26,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":117,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":143,"read_time":102},18829141979164,"https://eur-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","Package ‘ggsankeyfier’  \nMay 8, 2026  \nType Package  \nTitle Create Sankey and Alluvial Diagrams Using 'ggplot2'Version 0.1.8  \nDate 2024-04-08  \nAuthor Pepijn de Vries [aut, cre, dtc](ORCID:\u003C[https://orcid.org/0000-0002-7961-6646](https://orcid.org/0000-0002-7961-6646)>),  \nGerjan Piet [dtc](ORCID: \u003C[https://orcid.org/0000-0003-0702-1624](https://orcid.org/0000-0003-0702-1624)>), Ruud Jongbloed [dtc](ORCID: \u003C[https://orcid.org/0000-0002-9378-5382](https://orcid.org/0000-0002-9378-5382)>), Anne Grundlehner [dtc](ORCID: \u003C[https://orcid.org/0000-0003-3375-351](https://orcid.org/0000-0003-3375-351)1>), Jacqueline Tamis [dtc](ORCID: \u003C[https://orcid.org/0000-0002-8206-5830](https://orcid.org/0000-0002-8206-5830)>)  \nMaintainer Pepijn de Vries \u003C[pepijn.devries@outlook.com](pepijn.devries@outlook.com)>  \nDescription Sankey and alluvial diagrams visualise flows of quantities across stages in stacked bars. This package makes it easy to create such diagrams using 'ggplot2'.  \nDepends R (>= 4.1.0)  \nImports dplyr, ggplot2 (>= 3.4.4), grid (>= 4.1.0), gridBezier, methods, rlang, scales, stats, tidyr, vwline  \nSuggests knitr, rmarkdown, stringr, svglite, testthat (>= 3.0.0), vdiffr  \nLicense GPL (>= 3) Encoding UTF-8 LazyData true RoxygenNote 7.2.3  \nCollate 'draw_edges.r' 'draw_key.r' 'ecosystem_services.r''geom_segment.r' 'scale_waist.r' 'geom_edge.r''position_helpers.r' 'geom_node.r' 'ggsankeyfier-package.r''imports.r' 'pivot_stages.r' 'position.r' 'short_cuts.r''stat_edge.r' 'stat_node_helpers.r' 'stat_node.r'  \nVignetteBuilder knitr Config/testthat/edition 3  \n2 draw_key_sankeyedge  \nURL [https://pepijn-devries.github.io/ggsankeyfier/](https://pepijn-devries.github.io/ggsankeyfier/), [https://github.com/pepijn-devries/ggsankeyfier/](https://github.com/pepijn-devries/ggsankeyfier/)  \nBugReports [https://github.com/pepijn-devries/ggsankeyfier/issues](https://github.com/pepijn-devries/ggsankeyfier/issues)[ ](https://github.com/pepijn-devries/ggsankeyfier/issues)NeedsCompilation no  \nRepository CRAN  \nDate/Publication 2024-04-08 13:30:07 UTC  \nContents  \ndraw_key_sankeyedge ................................... 2  \necosystem_services ..................................... 3  \nGeomSankeynode ...................................... 5  \nGeomSankeysegment .................................... 8  \npivot_stages_longer ..................................... 12  \nPositionSankey ....................................... 13  \nscale_waist_continuous ................................... 16  \nStatSankeyedge ....................................... 17  \nIndex 20  \ndraw_key_sankeyedge Key glyphs for legends  \nDescription  \nEach geom has an associated function that draws the key when the geom needs to be displayed ina legend. These functions are called draw_key_ *(), where * stands for the name of the respective key glyph. The key glyphs can be customized for individual geoms by providing a geom with the key_glyph argument (see layer() or examples below.)  \nUsage  \ndraw_key_sankeyedge(data, params, size)  \ndraw_key_sankeynode(data, params, size)  \nArguments  \ndata A single row data frame containing the scaled aesthetics to display in this key  \nparams A list of additional parameters supplied to the geom.  \nsize Width and height of key in mm.  \nValue  \nA grid grob.  \necosystem_services 3  \nAuthor(s)  \nPepijn de Vries  \nExamples  \n\\#\\# The key glyph for sankey diagrams can be applied to different geoms as well.  \n\\#\\# In the example below it is applied to a histogram  \nlibrary(ggplot2)  \nggplot(data.frame(x = rnorm(100), groups = rep(letters[1:2], 2)),  \naes(x = x, fill = groups)) +  \ngeom_histogram(key_glyph = draw_key_sankeyedge, binwidth = 0.2, alpha = 1) ggplot(data.frame(x = rnorm(100), groups = rep(letters[1:2], 2)),  \naes(x = x, fill = groups)) +  \ngeom_histogram(key_glyph = draw_key_sankeynode, binwidth = 0.2)  \n\n| ecosystem_services | Data on risks to supply ecosystem services |\n| --- | --- |\n\nDescription  \nData indicating a risk resulting from anthropologic","cbCaiaRMpS2PQlpz","https://ap.wps.com/l/cbCaiaRMpS2PQlpz","pdf",137013,"English","# draw_key_sankeyedge\n# ecosystem_services\n## Description\n## Format\n# Draw and Geom Components\n## GeomSankeynode\n## GeomSankeysegment\n## StatSankeyedge","[{\"question\":\"What problem does ggsankeyfier solve?\",\"answer\":\"It visualizes flows of quantities across stages in Sankey and alluvial diagrams, making it easy to create such diagrams with ggplot2.\"},{\"question\":\"How are legend key glyphs handled in this package?\",\"answer\":\"Each relevant geom has an associated draw_key_* function (e.g., draw_key_sankeyedge, draw_key_sankeynode) that returns a grid grob and can be customized via the key_glyph argument.\"},{\"question\":\"Why isn’t the ecosystem_services dataset directly plottable as a Sankey diagram?\",\"answer\":\"In its current wide format, it represents pathways in a way that requires pivoting with pivot_stages_longer() before producing a Sankey layout.\"}]","Create Sankey and Alluvial Diagrams Using 'ggplot2' - Package Documentation | PDF",1792975804]