×
Menu
Index

6.1.37.1 Methods Defined Here

__init__(ordering)
Constructor function for VESankey. If the string ‘depth’ is passed to the constructor, then the nodes in   the Sankey diagram will be sorted based on a depth-first traversal of the network. This can be useful to reduce cross-over of connections. 
 
add_connections([(source, destination, weight)])
Adds connections between nodes in the network. Each entry in the connections list should be a tuple containing the source node name (string), destination node name (string) and the connection weight (real).
source -> string
destination -> string
weight -> real
Nodes should already have been added through either add_node_names_in_order or add_node_columns
 
add_column_names ([columnNames])
Adds names for the columns in the diagram. Used for labelling the diagram.
 
add_node­_colours ({colours})
Sets the colour each node should be generated with. colours is a dictionary of {string : tuple}, where the string is the name of the node, and the tuple holds the RGB values for the colour of that  node.
 
add_node_columns({nodeColumns})
Adds nodes to the diagram, in the specified column index.
nodeColumns is a dictionary, where each entry is {node name (string) : column index (number)}.
 
add_node_names_in_order([names])
Adds names for the nodes to be used as labels in the diagram. Python Dictionaries do not retain ordering of items; this function can be used to ensure nodes are added to the diagram in the order they appear in the list. Can be useful to control positions of nodes in the final diagram.
add_node­_columns still needs to be called, regardless of weather add_node_names_in_order is called or not.
 
clear()
Clears all added data from the sankey generator. Necessary if you wish to reuse the same VESankey object to generate multiple different sankey diagrams.
 
generate_sankey()
Once all nodes and connections have been added, calling generate_sankey will generate an in-memory representation of the sankey diagram, ready for exporting.
 
recommended_ratio ()  -> real
Returns the recommended ratio for the connection weight:line width rations that will be used if no ratio is specified through set_weight_width_ratio.
 
save_png(filename)
After generate_sankey has been called, save_png will export the sankey diagram as a .png file.
 
save­_svg(filename)
After generate_sankey has been called, save_svg will export the sankey diagram as a .svg file.
 
set_title(title)
Sets the title of the diagram.
 
set_units_str (unit)
Sets the string to be used as a legend for representing the units the connection weights are in.
 
set_weight_width_ratio (ratio)
Sets the weight:line width ratio the diagram should use. Can be used to somewhat control how thick the connection lines should be with vastly differing weights.