• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Stream Graphs with Python
 

Stream Graphs with Python

on

  • 6,354 views

 

Statistics

Views

Total Views
6,354
Views on SlideShare
3,513
Embed Views
2,841

Actions

Likes
2
Downloads
14
Comments
0

5 Embeds 2,841

http://mechanicalintegrator.com 2686
http://tumblr.zest.id.lv 125
http://www.slideshare.net 21
http://translate.googleusercontent.com 6
http://bitly.com 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Stream Graphs with Python Stream Graphs with Python Presentation Transcript

    • Making Stream Graphs with Python Nathan Bergey April 29, 2010 Nathan Bergey Making Stream Graphs with Python
    • Starting Point I said “Hey, I can do that” Then, later, I did that Nathan Bergey Making Stream Graphs with Python
    • Python and Paper Working with Python was easy. http://leebyron.com/else/streamgraph/ Nathan Bergey Making Stream Graphs with Python
    • Stacked Graphs Nathan Bergey Making Stream Graphs with Python
    • Move it down Start at with g0 being some number other than 0. Nathan Bergey Making Stream Graphs with Python
    • Symmetry Nathan Bergey Making Stream Graphs with Python
    • A Simple Algorithm n 1 g0 = − fi 2 i=1 Nathan Bergey Making Stream Graphs with Python
    • A More Complex Algorithm n 1 g0 = − (n − i + 1)fi n+1 i=1 Nathan Bergey Making Stream Graphs with Python
    • Comparison Nathan Bergey Making Stream Graphs with Python
    • pystreamgraph http://github.com/natronics/pystreamgraph Takes a list of a list of data points. You provide Colors, Labels, etc. Draws it, but with some options Nathan Bergey Making Stream Graphs with Python
    • Preprocess Calculate the sum of the y values for i in range(0, n_points): y_sum = 0 for layer in range(0, n_layers): y_sum += data[layer][i][1] y_extent.append(y_sum) Nathan Bergey Making Stream Graphs with Python
    • Step 1 Calculate g0 g_0 = [] for i in range(n_points): g_0.append(- y_extent[i] / 2.0) Nathan Bergey Making Stream Graphs with Python
    • Draw it for layer in range(n_layers): points = [] point_range = range(n_points) for i in point_range: x = data[layer][i][0] y = data[layer][i][1] y_stacked = g_0[i] + y for l in range(layer): y_stacked += self.data[l][i][1] points.append((x, y_stacked)) Nathan Bergey Making Stream Graphs with Python
    • Draw it point_range.reverse() for i in point_range: x = self.data[layer][i][0] y_stacked = g_0[i] for l in range(layer): y_stacked += self.data[l][i][1] points.append((x,y_stacked)) Nathan Bergey Making Stream Graphs with Python
    • A Single Shape Nathan Bergey Making Stream Graphs with Python
    • Labeling Not actually possible? Packing algorithms Make some random boxes Keep the largest one Nathan Bergey Making Stream Graphs with Python
    • SVG Using SVGFig http://code.google.com/p/svgfig/ Could be better Custom interpolation? Nathan Bergey Making Stream Graphs with Python
    • Resources Me: @natronics pystreamgraph: http://github.com/natronics/pystreamgraph Nathan Bergey Making Stream Graphs with Python