oopnet.plotter package

Submodules

oopnet.plotter.bokehplot module

class oopnet.plotter.bokehplot.Plotsimulation(network, tools=None, links=None, nodes=None, colormap='jet')

Bases: object

This function plots OOPNET networks with simulation results as a network plot with Bokehplot.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars standing on their top in the middle, Pumps are plotted as lines with triangulars standing on an edge

Parameters:
  • network – OOPNET network object one wants to plot

  • tools – tools used for the Bokeh plot (panning, zooming, …)

  • nodes – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Pressure(rpt)). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • links – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)). f links is None or specific links do not have values, then the links are drawn as black lines

  • colormap – Colormap defining which colors are used for the simulation results (default is matplotlib’s colormap jet). colormap can either be a string for matplotlib colormaps, a matplotlib.colors.LinearSegmentedColormap object or a matplotlib.colors.ListedColormap object. If one wants to use different colormaps for nodes and links, then make use of a dictionary with key ‘node’ for nodes respectively key ‘link’ for links (e.g. colormaps = {‘node’:’jet’, ‘link’:’cool’} plots nodes with colormap jet and links using colormap cool)

Returns:

Bokehplot’s figure handle

oopnet.plotter.bokehplot.colorfun(series, colormap='jet')
Parameters:
  • series

  • colormap – (Default value = ‘jet’)

Returns:

oopnet.plotter.bokehplot.convert_to_hex(rgba_color)
Parameters:

rgba_color

Returns:

oopnet.plotter.bokehplot.outsidelist(element, colorhash)
Parameters:
  • element

  • colorhash

Returns:

Parameters:
  • f

  • elements

  • colors

  • marker – (Default value = ‘o’)

Returns:

oopnet.plotter.bokehplot.plotnode(f, elements, colors, marker='o')
Parameters:
  • f

  • elements

  • colors

  • marker – (Default value = ‘o’)

Returns:

oopnet.plotter.bokehplot.plotpipe(f, elements, colors)

oopnet.plotter.pyplot module

class oopnet.plotter.pyplot.NetworkPlotter(colorbar=True, colormap='viridis', truncate_nodes=False, robust=False, markersize=5.0)

Bases: object

Class for creating static matplotlib plots and matplotlib animations.

Parameters:
  • colorbar (Union[bool, dict]) – If True a colorbar is created, if False there is no colorbar in the plot. If one wants to set this setting for nodes and links seperatly, make use of a dictionary with key ‘node’ for nodes respectively key ‘link’ for links (e.g. colorbar = {‘node’:True, ‘link’:False} plots a colorbar for nodes but not for links)

  • colormap (Union[str, dict]) – Colormap defining which colors are used for the simulation results (default is matplotlib’s colormap viridis). colormap can either be a string for matplotlib colormaps, a matplotlib.colors.LinearSegmentedColormap object or a matplotlib.colors.ListedColormap object. If one wants to use different colormaps for nodes and links, then make use of a dictionary with key ‘node’ for nodes respectively key ‘link’ for links (e.g. colormaps = {‘node’:’jet’, ‘link’:’cool’} plots nodes with colormap jet and links using colormap cool)

  • truncate_nodes (bool) – If True, only junctions for which a value was submitted using the nodes parameter are plotted. If the nodes parameters isn’t being used, all junctions are plotted. If not set True, junctions for which no value was submitted using the nodes parameters are plotted in black. This only applies to junctions and not to tanks and reservoirs, which are always plotted.

  • robust (bool) – If True, 2nd and 98th percentiles are used as limits for the colorbar, else the minima and maxima are used.

  • markersize (float) – size of markers

animate(network, fignum=None, ax=None, nodes=None, node_label=None, links=None, link_label=None, link_width=None, interval=500, repeat=False, nodes_vlim=None, links_vlim=None)

This function plots OOPNET networks with simulation results as a network plot with Matplotlib.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars in the middle, Pumps are plotted as lines with pentagons

Parameters:
  • network (Network) – OOPNET network object one wants to plot

  • fignum (Optional[int]) – figure number, where to plot the network

  • ax (Optional[Axes]) – Matplotlib Axes object

  • nodes (Optional[DataFrame]) – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport properties (e.g. rpt.pressure). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • node_label (Optional[str]) – label for the Node values colorbar

  • nodes_vlim (Optional[tuple[float, float]]) – limits for the Node values colorbar as tuple (min, max)

  • links (Optional[DataFrame]) – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport properties (e.g. rpt.flow). If links is None or specific links do not have values, then the links are drawn as black lines

  • link_label (Optional[str]) – label for the Link values colorbar

  • links_vlim (Optional[tuple[float, float]]) – limits for the Link values colorbar as tuple (min, max)

  • link_width (Optional[DataFrame]) – Values describing the link width as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)).

  • interval (int) – interval between the individual frames

  • repeat (bool) – if True, the animation will be created as a recurring loop

Return type:

FuncAnimation

Returns:

Matplotlib’s figure handle

plot(network, fignum=None, nodes=None, links=None, link_width=None, ax=None, nodes_vlim=None, links_vlim=None)

This function plots OOPNET networks with simulation results as a network plot with Matplotlib.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars in the middle, Pumps are plotted as lines with pentagons

Parameters:
  • network (Network) – OOPNET network object one wants to plot

  • fignum (Optional[int]) – figure number, where to plot the network

  • nodes (Optional[Series]) – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Pressure(rpt)). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • nodes_vlim (Optional[tuple[float, float]]) –

  • links (Optional[Series]) – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)). If links is None or specific links do not have values, then the links are drawn as black lines

  • links_vlim (Optional[tuple[float, float]]) –

  • link_width (Optional[Series]) – Values describing the link width as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)).

  • ax (Optional[Axes]) – Matplotlib Axes object

Returns:

Matplotlib’s figure handle

Module contents