uesgraphs package

uesgraphs.get_versioning_info()[source]

Returns the versioning information of uesgraphs.

Subpackages

Submodules

uesgraphs.uesgraph module

class uesgraphs.uesgraph.UESGraph[source]

Bases: Graph

A networkx Graph enhanced for use to describe urban energy systems.

name

Name of the graph

Type:

str

# TODO
Type:

delete input ids

input_ids

When input is read from json files with ids in their meta data, these ids are stored in this dict

Type:

dict

nodelist_street

List of node ids for all street nodes

Type:

list

nodelist_building

List of node ids for all building nodes

Type:

list

nodelists_heating

Dictionary contains nodelists for all heating networks. Keys are names of the networks in str format, values are lists of all node ids that belong to the network

Type:

dict

nodelists_cooling

Dictionary contains nodelists for all cooling networks. Keys are names of the networks in str format, values are lists of all node ids that belong to the network

Type:

dict

nodelists_electricity

Dictionary contains nodelists for all electricity networks. Keys are names of the networks in str format, values are lists of all node ids that belong to the network

Type:

dict

nodelists_gas

Dictionary contains nodelists for all gas networks. Keys are names of the networks in str format, values are lists of all node ids that belong to the network

Type:

dict

nodelists_others

Dictionary contains nodelists for all other networks. Keys are names of the networks in str format, values are lists of all node ids that belong to the network

Type:

dict

network_types

A list of all supported network types with their names in str format

Type:

list

nodes_by_name

A dictionary with building names for keys and node numbers for values. Used to retrieve node numbers for a given building name.

Type:

dict

positions

In general, positions in uesgraphs are defined by shapely.geometry.point objects. This attribute converts the positions into a dict of numpy arrays only for use in uesgraphs.visuals, as the networkx drawing functions need this format.

Type:

dict

min_position

Position with smallest x and y values in the graph

Type:

shapely.geometry.point object

max_position

Position with largest x and y values in the graph

Type:

shapely.geometry.point object

next_node_number

Node number for the next node to be added

Type:

int

simplification_level

Higher values indicate more simplification of the graph 0: no simplification 1: pipes connected in series are simplified to 1 aggregate pipe

Type:

int

pipeIDs

List of pipeIDs used in the graph

Type:

list

__init__()[source]

Constructor for UESGraph class.

property node
property positions

Set position.

new_node_number()[source]

Return a new 4 digits node number that is not yet used in graph.

Returns:

new_number – 4 digit number not yet used for nodes in graph

Return type:

int

add_network(network_type, network_id)[source]

Add a new network of specified type.

Parameters:
  • network_type (str) – Specifies the type of the new network as {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • network_id (str) – Name of the new network

add_building(name=None, position=None, is_supply_heating=False, is_supply_cooling=False, is_supply_electricity=False, is_supply_gas=False, is_supply_other=False, attr_dict=None, replaced_node=None, **attr)[source]

Add a building node to the UESGraph.

Parameters:
  • name (str, int, or float) – A name for the building represented by this node. If None is given, the newly assigned node number will also be used as name.

  • position (shapely.geometry.Point object) – New node’s position

  • is_supply_heating (boolean) – True if the building contains a heat supply unit, False if not

  • is_supply_cooling (boolean) – True if the building contains a cooling supply unit, False if not

  • is_supply_electricity (boolean) – True if the building contains an electricity supply unit, False if not

  • is_supply_gas (boolean) – True if the building contains a gas supply unit, False if not

  • is_supply_other (boolean) – True if the building contains a supply unit for a network of network type other, False if not

  • attr_dict (dictionary, optional (default= no attributes)) – Dictionary of building attributes. Key/value pairs set data associated with the building

  • attr (keyword arguments, optional) – Set attributes of building using key=value

Returns:

node_number – Number of the added node in the graph

Return type:

int

remove_building(node_number)[source]

Remove the specified building node from the graph.

Parameters:

node_number (int) – Identifier of the node in the graph

add_street_node(position, resolution=0.0001, check_overlap=True, attr_dict=None, **attr)[source]

Add a street node to the UESGraph.

Parameters:
  • position (shapely.geometry.Point) – Definition of the node position with a shapely Point object

  • resolution (float) – Minimum distance between two points in m. If new position is closer than resolution to another existing node, the existing node will be returned, no new node will be created.

  • check_overlap (boolean) – By default, the method checks whether the new position overlaps an existing network node. This can be skipped for performance reasons by setting check_overlap=False

  • attr_dict (dictionary, optional (default= no attributes)) – Dictionary of node attributes. Key/value pairs set data associated with the node

  • attr (keyword arguments, optional) – Set attributes of node using key=value

Returns:

node_number – Number of the added node in the graph

Return type:

int

remove_street_node(node_number)[source]

Remove the specified street node from the graph.

Parameters:

node_number (int) – Identifier of the node in the graph

add_network_node(network_type, network_id='default', name=None, position=None, resolution=0.0001, check_overlap=True, attr_dict=None, **attr)[source]

Add a network node to the UESGraph.

A network node should not be placed at positions where there is already a node of the same network or a building node.

Parameters:
  • network_type (str) – Defines the network type into which to add the node. The string must be one of the network_types defined in self.network_types.

  • network_id (str) – Specifies, to which network of the given type the node belongs. If no value is given, the network ‘default’ will be used. Before using a network_id, it must be added to the UESGraph with self.add_network()

  • name (str, int, or float) – A name for the network junction represented by this node. If None is given, the newly assigned node number will also be used as name.

  • position (shapely.geometry.Point) – Optional definition of the node position with a shapely Point object

  • resolution (float) – Minimum distance between two points in m. If new position is closer than resolution to another existing node, the existing node will be returned, no new node will be created.

  • check_overlap (boolean) – By default, the method checks whether the new position overlaps an existing network node. This can be skipped for performance reasons by setting check_overlap=False

  • attr_dict (dictionary, optional (default= no attributes)) – Dictionary of node attributes. Key/value pairs set data associated with the node

  • attr (keyword arguments, optional) – Set attributes of node using key=value

Returns:

node_number – Number of the added node in the graph

Return type:

int

remove_network_node(node_number)[source]

Remove the specified network node from the graph.

Parameters:

node_number (int) – Identifier of the node in the graph

get_building_node(name)[source]

Return the node number for a given building name.

Parameters:

name (str) – Name of the building

Returns:

node_number – Number of the corresponding node

Return type:

int

get_node_by_position(position, resolution=0.0001)[source]

Return node name and node_nb for node(s) on input position.

If no node is placed on position, returns empty dictionary.

Parameters:
  • position (shapely.geometry.Point) – Queried position

  • resolution (float) – Minimum distance between two points in m. If position is closer than resolution to another existing node, the existing node will be returned.

Returns:

result_dict – Dictionary of nodes on input position (key: node_id, value: name)

Return type:

dict

create_subgraphs(network_type, all_buildings=True, streets=False)[source]

Return a list of subgraphs for each network.

Parameters:
  • network_type (str) – One of the network types defined in self.network_types. The subgraphs for all networks of the chosen network type will be returned

  • all_buildings (boolean) – Subgraphs will contain all buildings of uesgraph when all_buildings is True. If False, only those buildings connected to a subgraph’s network will be part of the corresponding subgraph

  • streets (boolean) – Subgraphs will contain streets if streets is True.

Returns:

subgraphs – List of uesgraph elements for all networks of chosen network_type

Return type:

list

from_json(path, network_type, check_overlap=False)[source]

Import network from json input.

Parameters:
  • path (str) – Path, where input files substations.json, nodes.json, pipes.json and supply.json are located.

  • network_type (str) – Specifies the type of the destination network as {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • check_overlap (Boolean) – By default, the method does not check whether network node positions overlap existing network nodes. For True, this check becomes active.

to_json(path=None, name=None, description='json export from uesgraph', all_data=False, prettyprint=False)[source]

Save UESGraph structure to json files.

Parameters:
  • path (str) – Path where a directory with output files will be created. If None is given, the json data will not be written to file, but only returned. This only works for format_old=False.

  • name (str) – The newly created output directory at path will be named <name>HeatingUES

  • description (str) – A description string that will be written to all json output files’ meta data.

  • all_data (boolean) – If False, only the main data (x, y, name, node_type) will be written to the json output. If True, all node data is exported.

  • prettyprint (boolean) – If True, the JSON file will use an indent of 4 spaces to pretty- print the file. By default, a more efficient output without indents will be generated

Returns:

output_data – Contents of the nodes.json file following the new format. For format_old=True the method returns None.

Return type:

dict

from_osm(osm_file, name=None, check_boundary=False, transform_positions=True)[source]

Import buildings and streets from OpenStreetMap data in osm_file.

If available, the following attributes will be written to the imported elements:

For streets: - ‘street type’ (motorway, trunk,primary, secondary, tertiary, residential, unclassified, service, living_street, pedestrian)

For buildings - ‘position’ - ‘outlines’ - ‘area’ - ‘addr_street’ - ‘addr_housenumber’ - ‘building_levels’ - ‘building_height’ - ‘building_buildyear’ - ‘building_condition’ - ‘building_roof_shape’ - ‘comments’ - type of usage (‘amenity’, ‘shop’, ‘leisure’)

Parameters:
  • osm_file (str) – Full path to osm input file

  • name (str) – Name of the city for boundary check

  • check_boundary (boolean) – If True, the city boundary will be extracted from the osm file and only nodes within this boundary will be accepted

  • transform_positions (boolean) – By default, positions are transformed to a coordinate system that gives distances in Meter setting the origin (0, 0) at the minimum position of the graph. If transform_positions is False, the positions will remain in longitude and latitude as read from the OSM file.

Returns:

self – UESGraph for the urban energy system read from osm data

Return type:

uesgraph object

from_geojson(network_path, buildings_path, supply_path, name, save_path=None, generate_visualizations=False)[source]

Import district heating network from GeoJSON files.

Creates a complete UESGraph model from three GeoJSON input files containing network topology, supply points, and building locations. All geometries must use CRS84 coordinate system and will be automatically transformed to a local coordinate system with distances in meters.

The import process follows these steps: 1. Process network pipes to create nodes and edges 2. Add supply points as buildings with is_supply_heating=True 3. Connect buildings to network nodes 4. Transform to local coordinate system and calculate network length

Parameters:
  • network_path (str) – Path to network GeoJSON file containing LineString or MultiLineString geometries representing pipes. Optional DN property specifies nominal diameter in mm.

  • buildings_path (str) – Path to buildings GeoJSON file containing Point or Polygon geometries. Must include ‘name’ property for each building.

  • supply_path (str) – Path to supply points GeoJSON file containing Point geometries. Must include ‘name’ property. Points must coincide with network nodes.

  • name (str) – Name identifier for this network model

  • save_path (str, optional) – Directory path for saving JSON output and visualizations. If None, no files are saved.

  • generate_visualizations (bool, default False) – Whether to generate and save network visualization PDFs at each processing step. Requires save_path to be specified.

Notes

  • Network nodes are created at pipe endpoints and junctions

  • Buildings replace network nodes at matching locations

  • Supply points must exactly match existing network node positions

  • Edge lengths are calculated automatically in meters

  • All custom properties from GeoJSON are preserved as edge attributes

Examples

>>> graph = UESGraph()
>>> graph.from_geojson(
...     network_path='data/network.geojson',
...     buildings_path='data/buildings.geojson',
...     supply_path='data/supply.geojson',
...     name='district_1',
...     save_path='output/',
...     generate_visualizations=True
... )
>>> print(f"Total network length: {graph.network_length} m")
number_of_nodes(node_type)[source]

Return number of nodes for given node_type.

Parameters:

node_type (str) – {‘building’, ‘street’, ‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘other’}

Returns:

number_of_nodes – The number of nodes for the given node_type

Return type:

int

calc_network_length(network_type)[source]

Calculate the length of all edges for given network_type.

Parameters:

network_type (str) – One of the network types defined in self.network_types

Returns:

total_length – Total length of all edges for given network_type in m

Return type:

float

calc_total_building_ground_area()[source]

Return the sum of all available building ground areas in m**2.

Returns:

total_ground_area – Sum of all available building ground areas in m**2

Return type:

float

rotate(degrees)[source]

Rotate all nodes of the graph by degrees.

Parameters:

degrees (float) – Value of degrees for rotation

network_simplification(network_type, network_id='default')[source]

Simplify a pipe network by replacing serial pipes.

Parameters:
  • network_type (str) – Specifies the type of the network as {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • network_id (str) – Name of the network

remove_unconnected_nodes(network_type, network_id='default', max_iter=10)[source]

Remove any edges and network nodes not connected to a supply node.

Parameters:
  • network_type (str) – Specifies the type of the network as {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • network_id (str) – Name of the network

  • max_iter (int) – Maximum number of iterations

Returns:

removed – Names of removed network nodes

Return type:

list

remove_self_edges(network_type, network_id='default')[source]

Remove edges with length 0 m.

Parameters

‘electricity’, ‘gas’, ‘others’}

network_idstr

Name of the network

Returns:

number_removed_edges – Number of removed network edges

Return type:

int

remove_dead_ends(network_type, network_id='default')[source]

Remove any nodes and edges that lead to dead ends in the network.

Parameters:
  • network_type (str) – Specifies the type of the network as {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • network_id (str) – Name of the network

Returns:

removed – Names of removed network nodes

Return type:

list

calc_angle(a, b, output='rad')[source]

Return the angle of a line from point a to b in rad or degrees.

Parameters:
  • a (shapely.geometry.point object) –

  • b (shapely.geometry.point object) –

  • output (str) – Selection of output unit between ‘rad’ and ‘degrees’

Returns:

angle – Angle of a line from point a to b in rad or degrees

Return type:

float

get_min_max(key, mode)[source]

Get minimum and maximum values for a specific attribute from nodes or edges.

Takes a UESGraph object and returns the minimum and maximum values for a given attribute key, either from all nodes or all edges depending on the specified mode.

Parameters:
  • key (str) – Attribute key to look up (e.g. ‘capacity’, ‘flow’, etc.)

  • mode (str) – Either ‘node’ or ‘edge’ to specify whether to look at node or edge attributes

Returns:

(minimum value, maximum value) for the specified attribute

Return type:

tuple

Raises:
  • ValueError – If no values are found or mode is invalid

  • KeyError – If the specified attribute key doesn’t exist for all nodes/edges

uesgraphs.utilities module

Utilies: Collection of all utility functions that are useful in several classes.

uesgraphs.utilities.default_json_path()[source]

Creates default output file UESgraphOutput in the user dictionary.

Paramters

UESgraph_defaul_pathstr

Path, where uesgraph files will be saved.

returns:

path – Path, where to save uesgraph files

rtype:

str

uesgraphs.utilities.make_workspace(name_workspace=None)[source]

Creates a local workspace with given name

If no name is given, the general workspace directory will be used

Parameters:

name_workspace (str) – Name of the local workspace to be created

Returns:

workspace – Full path to the new workspace

Return type:

str

uesgraphs.utilities.name_uesgraph(name_workspace=None)[source]

Gives the uesgraph a name

Parameters:

name_workspace (str) – Name of the workspace of the current uesgraph

Returns:

name_uesgraph – Name of the uesgraph according to its workspace

Return type:

str

uesgraphs.utilities.set_up_terminal_logger(name: str, level: int = 20) Logger[source]

Set up a simple console-only logger for small functions.

Parameters:
  • name – Logger name

  • level – Logging level (default: INFO)

Returns:

Configured console logger

uesgraphs.utilities.set_up_file_logger(name: str, log_dir: str | None = None, level: int = 40) Logger[source]

Set up a full file+console logger for major functions.

Parameters:
  • name – Logger name

  • log_dir – Directory for log files (default: temp directory)

  • level – Logging level (default: ERROR)

Returns:

Configured file+console logger

uesgraphs.utilities.get_attribute_case_insensitive(row, attribute_name)[source]

Retrieve an attribute value from a dictionary, handling case insensitivity.

This function tries to access the attribute with the original name first, then attempts to access it with different capitalizations if the original attempt fails.

Parameters:
  • row (dict) – The dictionary containing the data

  • attribute_name (str) – The base name of the attribute to retrieve

Returns:

The value associated with the attribute, or None if not found

uesgraphs.visuals module

This module contains visualization tools for uesgraphs

uesgraphs.visuals.set_up_logger(name, log_dir=None, level=40)[source]
class uesgraphs.visuals.Visuals(uesgraph, log_level=10)[source]

Bases: object

Visualizes a uesgraph by networkX graph drawing

Parameters:

uesgraph (uesgraphs.uesgraph.UESGraph object) – The visualization output will be following the graph layout specified in the input uesgraph

__init__(uesgraph, log_level=10)[source]

Constructor for Visuals

create_plot_simple(ax, scaling_factor=0.5)[source]

Creates a very simple plot setup for fast performance

Parameters:
  • ax (maplotlib ax object) –

  • scaling_factor (float) – Factor that scales the sized of node dots in the plot relative to the edge widths

Returns:

ax

Return type:

maplotlib ax object

create_plot(ax, labels=None, show_diameters=False, show_mass_flows=False, show_press_flows=False, show_press_drop_flows=False, show_velocity=False, show_temperature_drop=False, label_size=7, edge_markers=[], node_markers=[], add_diameter=False, add_edge_temperatures=False, add_edge_flows=False, add_edge_pressures=False, add_edge_pressure_drop=False, add_edge_velocity=False, add_temperature_drop=False, add_temperature_diff=False, directions=False, scaling_factor=1.5, scaling_factor_diameter=5, minmaxtemp=False, minmaxmflow=False, minmaxmpress=False, minmaxmpressdrop=False, minmaxmvelocity=False, minmaxmtempdrop=False, generic_intensive_size=None, generic_extensive_size=None, minmax=False, zero_alpha=1, cmap='viridis')[source]

Creates the plot setup, that can be shown or saved to file

Parameters:
  • ax (maplotlib ax object) –

  • labels (str) – If set to ‘street’, node numbers of street nodes are shown in plot

  • show_diameters (boolean) – True if edges of heating networks should show the relative diameter of the pipe, False if not

  • show_mass_flows (boolean) – True if edges of heating networks should show the mass flow rate through the pipe, False if not

  • show_press_flows (boolean) – True if edges of heating networks should show the pressure through the pipe, False if not

  • show_press_drop_flows (boolean) – True if edges of heating networks should show the pressure drop through the pipe, False if not

  • label_size (int) – Fontsize for optional labels

  • edge_markers (list) – A list of edges that should be marked in the plot

  • node_markers (list) – A list of nodes that should be marked in the plot

  • add_edge_temperatures (boolean) – Plots edge temperatures on top of plot if True

  • add_edge_flows (boolean) – Plots edge width according to flow rates in the networks if True

  • add_edge_pressures (boolean) – Plots edge pressure on top of plot if True

  • add_edge_pressure_drop (boolean) – Plots edge pressure drop on top of plot if True

  • add_edge_electricity (boolean) – Plots edge electricity on top of plot if True

  • directions (boolean) – Plots arrows for flow directions if True; If add_edge_flows is False, these arrows will show the initial assumed flow direction. If add_edge_flows is True, the arrows show the calculated flow direction.

  • scaling_factor (float) – Factor that scales the sized of node dots in the plot relative to the edge widths

  • scaling_factor_diameter (float) – Factor that scales the width of lines for show_diameters = True

  • generic_intensive_size (str) – If set to a string, the edges will be colored according to the values of the attribute with the given string

  • generic_extensive_size (str) – If set to a string, the edges will be colored according to the values of the attribute with the given string

  • minmax (array) – Contains the minimum and maximum values for the generic size in format [min, max]

  • zero_alpha (float) – Alpha value to paint certain edges transparent. Look at docstring of paint_edges_extensive_sizes for more information

  • cmap (str, optional) – Name of the colormap to use for visualization (default=’viridis’). Common options include ‘viridis’, ‘coolwarm’, ‘RdYlGn’, ‘plasma’, ‘Blues’. For temperature data, ‘coolwarm’ or ‘RdYlGn’ provide intuitive red=hot, blue=cold color semantics.

Returns:

ax

Return type:

maplotlib ax object

create_plot_3d(ax, z_attrib='pressure', show_flow=False, angle=110, label_size=20)[source]

Creates the plot setup for a 3d view

Parameters:
  • ax (maplotlib ax object) –

  • z_attrib (str) – Keyword to control which attribute of nodes will be used for the z-coordinate

  • show_flow (boolean) – Varies linewidth of the edges if True

  • angle (float) – View angle for 3d plot

  • label_size (int) – Fontsize for labels

Returns:

ax

Return type:

maplotlib ax object

show_network(save_as=None, show_plot=True, labels=None, show_diameters=False, show_mass_flows=False, show_press_flows=False, show_press_drop_flows=False, show_velocity=False, show_temperature_drop=False, label_size=7, edge_markers=[], node_markers=[], add_diameter=False, add_edge_temperatures=False, add_temperature_drop=False, add_temperature_diff=False, add_edge_flows=False, add_edge_pressures=False, add_edge_pressure_drop=False, add_edge_velocity=False, directions=False, scaling_factor=1.5, scaling_factor_diameter=5, simple=False, dpi=150, minmaxtemp=False, minmaxmflow=False, minmaxmpress=False, minmaxmpressdrop=False, minmaxmvelocity=False, minmaxmtempdrop=False, timestamp=False, generic_intensive_size=None, generic_extensive_size=None, minmax=None, ylabel=None, zero_alpha=1, cmap='viridis')[source]

Shows a plot of the network

Parameters:
  • save_as (str) – optional parameter, string denoting full path and file name + extension for saving the plot

  • show_plot (boolean) – True if the plot should be shown in the current Python instance, False if not

  • labels (str) – If set to ‘street’, node numbers of street nodes are shown in plot

  • show_diameters (boolean) – True if edges of heating networks should show the relative diameter of the pipe, False if not

  • show_mass_flows (boolean) – True if edges of heating networks should show the mass flow rate through the pipe, False if not

  • show_press_flows (boolean) – True if edges of heating networks should show the pressure through the pipe, False if not

  • show_press_drop_flows (boolean) – True if edges of heating networks should show the pressure drop through the pipe, False if not

  • label_size (int) – Fontsize for optional labels

  • edge_markers (list) – A list of edges that should be marked in the plot

  • node_markers (list) – A list of nodes that should be marked in the plot

  • add_edge_temperatures (boolean) – Plots edge temperatures on top of plot if True

  • add_edge_flows (boolean) – Plots edge width according to flow rates in the networks if True

  • add_edge_pressures (boolean) – Plots edge pressure on top of plot if True

  • add_edge_pressure_drop (boolean) – Plots edge pressure drop on top of plot if True

  • directions (boolean) – Plots arrows for flow directions if True; If add_edge_flows is False, these arrows will show the initial assumed flow direction. If add_edge_flows is True, the arrows show the calculated flow direction.

  • scaling_factor (float) – Factor that scales the sized of node dots in the plot relative to the edge widths

  • scaling_factor_diameter (float) – Factor that scales the width of lines

  • simple (boolean) – For very large uesgraphs, the standard plotting may take too long (hours…). In these cases, simple=True gives faster results

  • dpi (int) – Integer to overwrite the standard resolution of 150 dpi

  • minmaxtemp (array) – Array with minimum and maximum temperature value for the scaling of the plot. If not set the values will be calculated automatically

  • minmaxmflow (array) – Array with minimum and maximum temperature value for the scaling of the plot. If not set the values will be calculated automatically

  • minmaxmpress (array) – Array with minimum and maximum pressure value for the scaling of the plot. If not set the values will be calculated automatically

  • minmaxmpressdrop (array) – Array with minimum and maximum pressure drop value for the scaling of the plot. If not set the values will be calculated automatically

  • timestamp (datetime) – prints the actual timestamp on the plot

  • generic_intensive_size (str) – If set to a string, the edges will be colored according to the values of the attribute with the given string

  • generic_extensive_size (str) – If set to a string, the edges will be colored according to the values of the attribute with the given string

  • minmax (array) – Contains the minimum and maximum values for the generic size in format [min, max]

  • ylabel (str) – Label for the color scale when plotting generic size

  • zero_alpha (float) – Alpha value to paint certain edges transparent. Look at docstring of paint_edges_extensive_sizes for more information

  • cmap (str, optional) – Name of the colormap to use for visualization (default=’viridis’). Common options include ‘viridis’, ‘coolwarm’, ‘RdYlGn’, ‘plasma’, ‘Blues’. For temperature data, ‘coolwarm’ or ‘RdYlGn’ provide intuitive red=hot, blue=cold color semantics.

Returns:

fig

Return type:

matplotlib.figure.Figure

show_3d(save_as=None, show_plot=True, show_flow=False, z_attrib='pressure', angle=110, label_size=20)[source]

Shows an explosion plot of stacked networks in 3d view

Parameters:
  • save_as (str) – optional parameter, string denoting full path and file name + extension for saving the plot

  • show_plot (boolean) – True if the plot should be shown in the current Python instance, False if not

  • show_flow (boolean) – Varies linewidth of the edges if True

  • z_attrib (str) – Keyword to control which attribute of nodes will be used for the z-coordinate

  • angle (float) – View angle for 3d plot

  • label_size (int) – Fontsize for optional labels

Returns:

fig

Return type:

matplotlib.figure.Figure

network_explosion(save_as=None, show_plot=True, angle=250, networks=['all'], scaling_factor=1.5, dotted_lines=True)[source]

Shows a plot of the network in 3d view

Parameters:
  • save_as (str) – optional parameter, string denoting full path and file name + extension for saving the plot

  • show_plot (boolean) – True if the plot should be shown in the current Python instance, False if not

  • angle (float) – View angle for 3d plot

  • networks (list) – Instead of [‘all’], the networks list can specify which networks should be plotted. Accepted items are {‘heating’, ‘cooling’, ‘electricity’, ‘gas’, ‘others’}

  • scaling_factor (float) – Factor that scales the sized of node dots in the plot relative to the edge widths

  • dotted_lines (boolean) – Optional dotted lines between different levels of network explosion if set to True

Returns:

fig

Return type:

matplotlib.figure.Figure