Created
May 7, 2014 08:32
-
-
Save msund/6c90368291eb8889f7c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:5b129fc2319c69f224d9a91e318062ccae241c3a6f5cf531d75bf9b20169dca1" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import numpy as np\n", | |
"import matplotlib.pyplot as plt\n", | |
"\n", | |
"from matplotlib.sankey import Sankey\n", | |
"fig = plt.figure()\n", | |
"ax = fig.add_subplot(1, 1, 1, xticks=[], yticks=[],\n", | |
" title=\"Energy flows\")\n", | |
"sankey = Sankey(ax=ax, scale=0.01, offset=0.2, head_angle=90,\n", | |
" format='%.0f', unit='%')\n", | |
"sankey.add(flows=[100, -49, -26, -25], # Master flows. \n", | |
" labels = ['Bunker', 'Shaft', 'Heat', 'Exhaust'],\n", | |
" orientations=[0, 0, -1, 1],\n", | |
" pathlengths = [1, 0, 0.3, 0.3])\n", | |
"sankey.add(flows=[49, -30, -17, -2], \n", | |
" labels = [None, 'Resistance', 'Propeller', 'Transmission'],\n", | |
" orientations=[0, 1, 0, 1], prior=0, connect=(1,0),\n", | |
" pathlengths = [0, 0.9, 0.8, 0.6])\n", | |
"sankey.add(flows=[26, -17, -8, -1],\n", | |
" labels = [None, 'Air Cooler', 'Cooling water', 'Radiation'],\n", | |
" orientations=[0, 1, 1, 1], prior=0, connect=(2,0),\n", | |
" pathlengths = [0, 1.5, 1, 0.5])\n", | |
"sankey.add(flows=[30, -18, -12],\n", | |
" labels = [None, 'Hull Friction','Other'],\n", | |
" orientations=[0, -1, -1], prior=1, connect=(1,0),\n", | |
" pathlengths = [0.4, 0.5, 0.5])\n", | |
"#sankey.add(flows=[17, -3, -4, -6],\n", | |
"# labels = ['', 'Frictional Forces', 'Rotational Forces', 'Axial Losses'],\n", | |
"# orientations=[0, -1, -1, -1], prior=1, connect=(2,0),\n", | |
"# pathlengths = [1, 0.4, 0.4, 0.4])\n", | |
"diagrams = sankey.finish()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment