Plotting colored stream networks

Posted on Updated on

Visual exploration of stream networks and channel length profiles is a mandatory first step before advancing towards more sophisticated tools such as slope-area plots or chiplots. Taking a look at both planform river patterns and respective channel length profiles will provide a good impression of the three-dimensional river patterns. Here is a quick guide how to visualize a stream network using different colors for each river system (or drainage basin). An underappreciated function comes in handy here: STREAMobj2cell.

DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
FD  = FLOWobj(DEM,'preprocess','carve');
S   = STREAMobj(FD,'minarea',1000);
CS  = STREAMobj2cell(S);

h1 = subplot(1,2,1);
h2 = subplot(1,2,2);
clrs = jet(32);

for r=1:numel(CS);

set(h2,'DataAspectRatio',[1 1/16 1])


I have manually edited the figure to make the figure look nicer. The question, however, is: What is the function STREAMobj2cell doing? This function returns stream networks belonging to an individual drainage basin as separate STREAMobjs in a cell array. Having this cell array, you just need to loop through and index into the cell array to access individual “connected components” of the stream network. Together with other functions for stream network modification such as modify, trunk or klargestconncomps, I think STREAMobj2cell will greatly help you to automate your stream network analysis.


2 thoughts on “Plotting colored stream networks

    simr87 said:
    June 9, 2017 at 8:25 am

    How can I convert this graph in a excel or csv tab?

      wschwanghart responded:
      June 9, 2017 at 9:29 am

      Hi. You can’t convert the graph, but I guess you may want to export the data in some tabular format. This can be done with the function STREAMobj2XY which has some nice additional functionality. For example you could do the following to export a table with X, Y, Z and distance
      t = table;
      d = S.distance;
      [t.X,t.Y,t.Z,t.distance] = STREAMobj2XY(S,DEM,d);

      Hope this helps,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s