File Exchange

image thumbnail

Alluvial flow diagram

version (2.45 KB) by Alexander Carmeli
Plot flows from sources to sinks and relationships between categories.


Updated 12 Apr 2018

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Four video gamers play computer games during the morning, afternoon, and evening.
A matrix shows how many hours each gamer played during each part of the day.
Use an alluvial flow chart to graphically study the parts of the day when gamers like to play, and how the gamers distribute their play time.
The function was tested using R2008a. A comment showcases how automatic scalar and vector expansions (introduced in R2016b) can greatly simplify expressions.

Cite As

Alexander Carmeli (2020). Alluvial flow diagram (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Thanks for this great script. I have one little issue, when running test data there seems to be streamlines also for zero value. Anyone had experienced something like that?

Thanks for sharing this code. How can we specify patch colors?

Hi there,

Thanks for your code. It works perfectly! However, I was to add one more block. Let's say that now, we want to divide morning, afternoon and night in slots of 3 hours ... I've gone through the code and I don't have a clear idea how to do that. In reality, my purpose is to create something more complex...but I think this can solve it (in my case, if you add one more block, call it right_right_labels, I have to link new blocks that were not present in the left labels to from the right to the right to the right_right panel).

Thank you in advance!



Is there a way to set a minimum thickness for the lines? I have data with too large a difference, and some of the lines are pretty much invisible. Thank you!


Is there a way of exporting the resulting plot into a vector file?

I have been looking for a code to do just this! Well written, clear and easy to use! Thank you!


Graphics added.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux