plot_interactive_network#

module wntr.graphics.network

plot_interactive_network(wn, node_attribute=None, node_attribute_name='Value', title=None, node_size=8, node_range=[None, None], node_cmap='Jet', node_labels=True, link_width=1, add_colorbar=True, reverse_colormap=False, figsize=[700, 450], round_ndigits=2, add_to_node_popup=None, filename='plotly_network.html', auto_open=True)[source]#

Create an interactive scalable network graphic using plotly.

Parameters:
  • wn (wntr WaterNetworkModel) – A WaterNetworkModel object

  • node_attribute (None, str, list, pd.Series, or dict, optional) –

    • If node_attribute is a string, then a node attribute dictionary is created using node_attribute = wn.query_node_attribute(str)

    • If node_attribute is a list, then each node in the list is given a value of 1.

    • If node_attribute is a pd.Series, then it should be in the format {nodeid: x} where nodeid is a string and x is a float. The time index is not used in the plot.

    • If node_attribute is a dict, then it should be in the format {nodeid: x} where nodeid is a string and x is a float

  • node_attribute_name (str, optional) – The node attribute name, which is used in the node popup and node legend

  • title (str, optional) – Plot title

  • node_size (int, optional) – Node size

  • node_range (list, optional) – Node range ([None,None] indicates autoscale)

  • node_cmap (palette name string, optional) – Node colormap, options include Greys, YlGnBu, Greens, YlOrRd, Bluered, RdBu, Reds, Blues, Picnic, Rainbow, Portland, Jet, Hot, Blackbody, Earth, Electric, Viridis

  • node_labels (bool, optional) – If True, the graph will include each node labelled with its name and attribute value.

  • link_width (int, optional) – Link width

  • add_colorbar (bool, optional) – Add colorbar

  • reverse_colormap (bool, optional) – Reverse colormap

  • figsize (list, optional) – Figure size in pixels

  • round_ndigits (int, optional) – Number of digits to round node values used in the label

  • add_to_node_popup (None or pd.DataFrame, optional) – To add additional information to the node popup, use a DataFrame with node name as index and attributes as values. Column names will be added to the popup along with each value for a given node.

  • filename (string, optional) – HTML file name

  • auto_open (bool, optional) – Open the HTML file after creation