netflow.probe.visualization#

Functions

KM_between_groups(T, E, groups[, ...])

KM analysis for each group, with log-rank p-values.

alpha_numeric_sorted(a)

Sort the given iterable alpha-numerically.

dotplot(x, y[, c, s, size_exponent, marker, ...])

plot dotplots with prescribed color and shape

forceatlas2_layout(G[, pos, max_iter, ...])

Position nodes using the ForceAtlas2 force-directed layout algorithm.

plot_topology(G[, pos, with_node_labels, ...])

Draw the graph topology.

plot_topology2(G[, pos, with_node_labels, ...])

Draw the graph topology.

sin_layout(G_tda, d[, res, h, period, sep, root])

Node positions for sinusoidal layout of branches

wavy_curve_layout(G_tda, d[, a, b, C, h, ...])

Node positions for wavy spiral layout of branches

netflow.probe.visualization.KM_between_groups(T, E, groups, min_group_size=10, figsize=(9, 6), show_censors=False, ci_show=False, show_at_risk_counts=True, precision=4, ttl='', xlabel=None, colors=None, ax=None, **kwargs)[source]#

KM analysis for each group, with log-rank p-values.

Note: Does not check if any observation appears in more than one group before plotting the KM curve. However, common observations are removed before computing the log-rank p-value.

If ax is provided, any artists are removed from the legend and set to not be visible.

Parameters:
  • T (pandas.Series) – Time to event.

  • E (pandas.Series) – Indicate if event occured (1) or not (0).

  • groups

    ?

  • min_group_size (int) – Minimum group size to be included in analysis.

  • figsize – Figure size.

  • precision (int) – Precision shown for log-rank p-value.

  • ttl (str, optional) – Figure title.

  • colors (dict) – (Optional) Colors to plot lines, keyed by group label.

  • ax (matplotlib.axes._axes.Axes) – (Optional) the axis to use for plotting the survival curves.

  • **kwargs (dict) – Key-word arguments passed to lifelines.KaplanMeierFitter.plot

netflow.probe.visualization._branch_member_indices(G_tda, branch)[source]#
netflow.probe.visualization._branch_member_labels(G_tda, branch)[source]#
netflow.probe.visualization._branch_order(G_tda, Ghr)[source]#

Get ordered branches starting with longest branch.

netflow.probe.visualization._curve_sin(n_points, a=1.0, b=3.141592653589793, C=0.0, h=0.5, start=1.5)[source]#
Parameters:
  • h – height

  • a – period

netflow.probe.visualization._curve_trace(n_points, a=0.5, b=3.141592653589793, C=0.0, h=0.5, start=1.5)[source]#

Trace out the wavy spiral curve.

Parameters:
  • a (float) – Affects radius of the wave. Larger values result in a tighter wave.

  • h (float) – Affects how tight and long the spiral is. Smaller values result in a tighter, longer spiral

netflow.probe.visualization._interbranch_edges(G_tda, branch_a, branch_b)[source]#
netflow.probe.visualization._largest_branch(G_tda)[source]#
netflow.probe.visualization._neighboring_branches(G_tda, branch)[source]#
netflow.probe.visualization._sorted_members(G_tda, d, branch, root=None)[source]#
netflow.probe.visualization._trace_sin(n_points, start=0, resolution=0.35, h=1.0, period=0.39269908169872414)[source]#
netflow.probe.visualization.alpha_numeric_sorted(a)[source]#

Sort the given iterable alpha-numerically.

netflow.probe.visualization.dotplot(x, y, c=None, s=None, size_exponent=None, marker=None, cmap=None, vmin=None, vmax=None, norm=None, cbar_label=None, cbar_labelpad=None, cbar_label_y=None, cbar_kwargs=None, ax=None, figsize=(5, 4), size_legend_kwargs=None, size_legend_label=None, **kwargs)[source]#

plot dotplots with prescribed color and shape

Dots are plotted via matplotlib.pyplot.scatter.

Parameters:
  • x

  • y

  • c

  • s

  • size_exponent

  • marker

  • cmap

  • vmin

  • vmax

  • norm

  • cbar_label

  • cbar_labelpad

  • cbar_label_y

  • cbar_kwargs (dict) –

  • ax

  • figsize

  • size_legend_kwargs

  • size_legend_label

  • kwargs

netflow.probe.visualization.forceatlas2_layout(G, pos=None, *, max_iter=100, jitter_tolerance=1.0, scaling_ratio=2.0, gravity=1.0, distributed_action=False, strong_gravity=False, node_mass=None, node_size=None, weight=None, dissuade_hubs=False, linlog=False, seed=None, dim=2)[source]#

Position nodes using the ForceAtlas2 force-directed layout algorithm.

CreditThis code comes from networkx v3.4.2 source code, which can be found at

https://networkx.org/documentation/stable/_modules/networkx/drawing/layout.html#forceatlas2_layout

This function applies the ForceAtlas2 layout algorithm [1] to a NetworkX graph, positioning the nodes in a way that visually represents the structure of the graph. The algorithm uses physical simulation to minimize the energy of the system, resulting in a more readable layout.

Parameters:
  • G (nx.Graph) – A NetworkX graph to be laid out.

  • pos (dict or None, optional) – Initial positions of the nodes. If None, random initial positions are used.

  • max_iter (int (default: 100)) – Number of iterations for the layout optimization.

  • jitter_tolerance (float (default: 1.0)) – Controls the tolerance for adjusting the speed of layout generation.

  • scaling_ratio (float (default: 2.0)) – Determines the scaling of attraction and repulsion forces.

  • distributed_attraction (bool (default: False)) – Distributes the attraction force evenly among nodes.

  • strong_gravity (bool (default: False)) – Applies a strong gravitational pull towards the center.

  • node_mass (dict or None, optional) – Maps nodes to their masses, influencing the attraction to other nodes.

  • node_size (dict or None, optional) – Maps nodes to their sizes, preventing crowding by creating a halo effect.

  • dissuade_hubs (bool (default: False)) – Prevents the clustering of hub nodes.

  • linlog (bool (default: False)) – Uses logarithmic attraction instead of linear.

  • seed (int, RandomState instance or None optional (default=None)) – Used only for the initial positions in the algorithm. Set the random state for deterministic node layouts. If int, seed is the seed used by the random number generator, if numpy.random.RandomState instance, seed is the random number generator, if None, the random number generator is the RandomState instance used by numpy.random.

  • dim (int (default: 2)) – Sets the dimensions for the layout. Ignored if pos is provided.

Examples

>>> import networkx as nx
>>> G = nx.florentine_families_graph()
>>> pos = nx.forceatlas2_layout(G)
>>> nx.draw(G, pos=pos)

References

netflow.probe.visualization.plot_topology(G, pos=None, with_node_labels=False, with_edge_labels=False, ax=None, nodelist=None, edgelist=None, node_size=300, node_color='#1f78b4', edge_color='k', node_cbar=False, edge_cbar=False, node_cbar_kws={'location': 'bottom', 'orientation': 'horizontal', 'pad': 0.01}, edge_cbar_kws={'location': 'bottom', 'orientation': 'horizontal', 'pad': 0.1}, node_cbar_ticks_kws=None, edge_cbar_ticks_kws=None, node_cbar_label=None, edge_cbar_label=None, node_cbar_labelpad=None, edge_cbar_labelpad=None, node_cbar_label_y=None, edge_cbar_label_y=None, node_cbar_label_kws=None, edge_cbar_label_kws=None, node_shape='o', node_shape_mapper=None, node_alpha=None, edge_alpha=None, node_label_alpha=None, edge_label_alpha=None, node_cmap=None, edge_cmap=None, node_vmin=None, node_vmax=None, edge_vmin=None, edge_vmax=None, node_cmap_drawedges=None, edge_cmap_drawedges=None, border_linewidths=None, bordercolors=None, edge_width=1.0, edge_style='solid', edge_style_mapper=None, node_labels=None, edge_labels=None, node_show_legend=None, edge_show_legend=None, legend_kws=None, node_font_size=12, edge_font_size=10, node_font_color='k', edge_font_color='k', node_font_weight='normal', edge_font_weight='normal', node_font_family='sans-serif', edge_font_family='sans-serif', node_ticklabels_mapper=None, edge_ticklabels_mapper=None, node_bbox=None, edge_bbox=None, node_horizontalalignment='center', edge_horizontalalignment='center', node_verticalalignment='center', edge_verticalalignment='center', node_clip_on=True, edge_clip_on=True, margins=None, min_source_margin=0, min_target_margin=0, edge_label_pos=0.5, rotate=True)[source]#

Draw the graph topology.

Draw the graph topology with NetworkX with options for multiple node shapes.

Parameters:
  • G (graph) – A networkx graph

  • pos (dictionary, optional) – A dictionary with nodes as keys and positions as values. If not specified a kamada kawai layout positioning will be computed. See networkx.drawing.layout for functions that compute node positions.

  • with_{node (bool (default=False)) – Set to True to draw labels on the nodes and edges.

  • edge}_labels (bool (default=False)) – Set to True to draw labels on the nodes and edges.

  • ax (Matplotlib Axes object, optional) – Draw the graph in the specified Matplotlib axes.

  • nodelist (list (default=list(G))) – Draw only specified nodes.

  • edgelist (list (default=list(G.edges()))) – Draw only specified edges.

  • node_size (scalar or array (default=300)) – Size of nodes. If an array is specified it must be the same length as nodelist.

  • node_color (color or array of colors (default='#1f78b4')) – Node color. Can be a single color or a sequence of colors with the same length as nodelist. Color can be string or rgb (or rgba) tuple of floats from 0-1. If numeric values are specified they will be mapped to colors using the cmap and vmin,vmax parameters. See matplotlib.scatter for more details.

  • edge_color (color or array of colors (default='k')) – Edge color. Can be a single color or a sequence of colors with the same length as edgelist. Color can be string or rgb (or rgba) tuple of floats from 0-1. If numeric values are specified they will be mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.

  • {node (bool (default=True)) – If True, show color bar for node and edge colors. This is ignored if {node,edge}_color is a str.

  • edge}_cbar (bool (default = False)) – If True, show color bar for node and edge colors. This is ignored if {node,edge}_color is a str.

  • {node – Optional keyword arguments passed to matplotlib.pyplot.colorbar for the node and edge colorbars.

  • edge}_cbar_kws (dict) – Optional keyword arguments passed to matplotlib.pyplot.colorbar for the node and edge colorbars.

  • {node – Keyword arguments passed to matplotlib.pyplot.colorbar.set_ticklabels()

  • edge}_cbar_ticks_kws ({None, dict}) – Keyword arguments passed to matplotlib.pyplot.colorbar.set_ticklabels()

  • {node – Optional label for node and edge colorbar, if displayed.

  • edge}_cbar_label ({None, str}) – Optional label for node and edge colorbar, if displayed.

  • {node – Optional padding for node and edge colorbar label, if displayed.

  • edge}_cbar_labelpad ({None, int} (default = -10)) – Optional padding for node and edge colorbar label, if displayed.

  • {node – Optional y position for node and edge colorbar label, if displayed.

  • edge}_cbar_label_y ({None, float}) – Optional y position for node and edge colorbar label, if displayed.

  • {node – Colorbar label keyword arguments passed to matplotlib.pyplot.colorbar.set_label).

  • edge}_cbar_label_kws ({None, dict}) – Colorbar label keyword arguments passed to matplotlib.pyplot.colorbar.set_label).

  • node_shape (string or array of shapes (default='o')) – The shape of the node. Can be a single shape or a sequence of shapes with the same length as nodelist. Shape specification is as matplotlib.scatter marker, one of ‘os^>v<dph8’. Alternatively, to add a description of the node class represented by the shape to the legend, provide a single node class label or a sequence of node class labels with the same length as nodelist. If shape speficiations are not one of ‘os^>v<dph8’, they are treated as node class labels and are added to the legend. Use node_shape_mapper to manually specify the shape for each class.

  • node_shape_mapper (None or dict (default=None)) – A dictionary to map node class labels to shapes, keyed by node class labels that is expected to have a key for all unique node class labels in node_shape. The default is to cycle through the possible shapes ‘os^>v<dph8’, which may not be unique if there are more classes than unique markers. This is ignored if node_shape contains the shapes directly.

  • node_alpha (float, array of floats or None (default=None)) – The node transparency. This can be a single alpha value, in which case it will be applied to all the nodes of color. Otherwise, if it is an array, the elements of alpha will be applied to the colors in order (cycling through alpha multiple times if necessary).

  • edge_alpha (float or None (default=None)) – The edge transparency.

  • node_label_alpha (float or None (default=None)) – The node label text transparency

  • edge_label_alpha (float or None (default=None)) – The text transparency

  • {node – Colormap for mapping intensities of nodes and edges

  • edge}_cmap (Matplotlib colormap, optional) – Colormap for mapping intensities of nodes and edges

  • {node – Minimum and maximum for node and edge colormap scaling

  • edge}_vmin (float, optional) – Minimum and maximum for node and edge colormap scaling

  • {node – Minimum and maximum for node and edge colormap scaling

  • edge}_vmax (float, optional) – Minimum and maximum for node and edge colormap scaling

  • {node – Whether to draw lines at color boundries on node,edge colorbar. This is ignored if no colorbar is being shown. Default behavior is to draw edges for a discrete colormap and not for continuous colormaps.

  • edge}_cmap_drawedges (bool) – Whether to draw lines at color boundries on node,edge colorbar. This is ignored if no colorbar is being shown. Default behavior is to draw edges for a discrete colormap and not for continuous colormaps.

  • border_linewidths (scalar or sequence (default=1.0)) – Line width of symbol border.

  • bordercolors ([None | scalar | sequence] (default = node_color)) – Colors of node borders.

  • edge_width (float or array of floats (default=1.0)) – Line width of edges

  • edge_style (string or array of strings (default=solid line)) – Edge line style. Can be a single style or a sequence of styles with the same length as edgelist. Styles can be any of ‘-’, ‘–’, ‘-.’, ‘:’ or words like ‘solid’ or ‘dashed’. (See matplotlib.patches.FancyArrowPatch: linestyle) Alternatively, to add a description of the edge class represented by the style to the legend, provide a single edge class label or a sequence of edge class labels with the same length as edgelist. If style speficiations are not one of [‘-’, ‘–’, ‘-.’, ‘:’, ‘solid’, ‘dashed’, ‘dotted’, ‘dashdot’], they are treated as edge class labels and are added to the legend. Use edge_style_mapper to manually specify the style for each class.

  • edge_style_mapper (None or dict (default=None)) – A dictionary to map edge class labels to styles, keyed by edge class and is expected to have a key for all include all unique edge class labels in edge_style. The default is to cycle through the possible edge styles [‘-’, ‘–’, ‘-.’, ‘:’], which may not be unique if there are more classes than unique styles. This is ignored if edge_style contains the styles directly.

  • node_labels (dictionary (default=None)) – Node labels in a dictionary of text labels keyed by node

  • edge_labels (dictionary (default=None)) – Edge labels in a dictionary of labels keyed by edge two-tuple. Only labels for the keys in the dictionary are drawn.

  • {node – If True, add legend with node shape or edge style. Default is True, but this is ignored if node_shape or edge_style is not provided.

  • edge}_show_legend (bool) – If True, add legend with node shape or edge style. Default is True, but this is ignored if node_shape or edge_style is not provided.

  • legend_kws ({None, dict} (default=None)) – Keyword arguments passed to ax.legend.

  • {node – Font size for text labels

  • edge}_font_size (int (default=12 for nodes, 10 for edges)) – Font size for text labels

  • {node – Font color string

  • edge}_font_color (string (default='k' black)) – Font color string

  • {node – Font weight

  • edge}_font_weight (string (default='normal')) – Font weight

  • {node – Font family

  • edge}_font_family (string (default='sans-serif')) – Font family

  • {node – If provided, used to assign labels to numeric values in color-bar when a discrete colormap is used.

  • edge}_ticklabels_mapper ({None, dict} (default=None)) – If provided, used to assign labels to numeric values in color-bar when a discrete colormap is used.

  • node_bbox (Matplotlib bbox, (default is Matplotlib's ax.text default)) – Specify text box properties (e.g. shape, color etc.) for node labels.

  • edge_bbox (Matplotlib bbox, optional) – Specify text box properties (e.g. shape, color etc.) for edge labels. Default is {boxstyle=’round’, ec=(1.0, 1.0, 1.0), fc=(1.0, 1.0, 1.0)}.

  • {node – Horizontal alignment {‘center’, ‘right’, ‘left’}

  • edge}_horizontalalignment (string (default='center')) – Horizontal alignment {‘center’, ‘right’, ‘left’}

  • {node – Vertical alignment {‘center’, ‘top’, ‘bottom’, ‘baseline’, ‘center_baseline’}

  • edge}_verticalalignment (string (default='center')) – Vertical alignment {‘center’, ‘top’, ‘bottom’, ‘baseline’, ‘center_baseline’}

  • {node – Turn on clipping of node labels at axis boundaries

  • edge}_clip_on (bool (default=True)) – Turn on clipping of node labels at axis boundaries

  • margins (float or 2-tuple, optional) – Sets the padding for axis autoscaling. Increase margin to prevent clipping for nodes that are near the edges of an image. Values should be in the range [0, 1]. See matplotlib.axes.Axes.margins() for details. The default is None, which uses the Matplotlib default.

  • min_source_margin (int (default=0)) – The minimum margin (gap) at the begining of the edge at the source.

  • min_target_margin (int (default=0)) – The minimum margin (gap) at the end of the edge at the target.

  • edge_label_pos (float (default=0.5)) – Position of edge label along edge (0=head, 0.5=center, 1=tail)

  • rotate (bool (deafult=True)) – Rotate edge labels to lie parallel to edges

Notes

  • If node_cmap is a discrete cmap or a ListedColormap and node_vmin is provided and larger than the min node_color or node_vmax is provided and smaller than the max node_color, then any values below node_vmin or above node_vmax will be shown as the same color (and label, if ticklabels were given) as node_vmin and node_vmax.

See also

networkx.draw, networkx.draw_networkx, networkx.draw_networkx_nodes, networkx.draw_networkx_edges, networkx.draw_networkx_labels, networkx.draw_networkx_edge_labels

netflow.probe.visualization.plot_topology2(G, pos=None, with_node_labels=False, with_edge_labels=False, ax=None, nodelist=None, edgelist=None, node_size=300, node_color='#1f78b4', edge_color='k', node_cbar=False, edge_cbar=False, node_cbar_kws={'location': 'bottom', 'orientation': 'horizontal', 'pad': 0.01}, edge_cbar_kws={'location': 'bottom', 'orientation': 'horizontal', 'pad': 0.1}, node_cbar_ticks_kws=None, edge_cbar_ticks_kws=None, node_cbar_label=None, edge_cbar_label=None, node_cbar_labelpad=None, edge_cbar_labelpad=None, node_cbar_label_y=None, edge_cbar_label_y=None, node_cbar_label_kws=None, edge_cbar_label_kws=None, node_shape='o', node_shape_mapper=None, node_alpha=None, edge_alpha=None, node_label_alpha=None, edge_label_alpha=None, node_cmap=None, edge_cmap=None, node_vmin=None, node_vmax=None, edge_vmin=None, edge_vmax=None, node_cmap_drawedges=None, edge_cmap_drawedges=None, border_linewidths=None, bordercolors=None, edge_width=1.0, edge_style='solid', edge_style_mapper=None, node_labels=None, edge_labels=None, node_show_legend=None, edge_show_legend=None, legend_kws=None, node_font_size=12, edge_font_size=10, node_font_color='k', edge_font_color='k', node_font_weight='normal', edge_font_weight='normal', node_font_family='sans-serif', edge_font_family='sans-serif', node_ticklabels_mapper=None, edge_ticklabels_mapper=None, node_bbox=None, edge_bbox=None, node_horizontalalignment='center', edge_horizontalalignment='center', node_verticalalignment='center', edge_verticalalignment='center', node_clip_on=True, edge_clip_on=True, margins=None, min_source_margin=0, min_target_margin=0, edge_label_pos=0.5, rotate=True)[source]#

Draw the graph topology.

Draw the graph topology with NetworkX with options for multiple node shapes.

Parameters:
  • G (graph) – A networkx graph

  • pos (dictionary, optional) – A dictionary with nodes as keys and positions as values. If not specified a kamada kawai layout positioning will be computed. See networkx.drawing.layout for functions that compute node positions.

  • with_{node (bool (default=False)) – Set to True to draw labels on the nodes and edges.

  • edge}_labels (bool (default=False)) – Set to True to draw labels on the nodes and edges.

  • ax (Matplotlib Axes object, optional) – Draw the graph in the specified Matplotlib axes.

  • nodelist (list (default=list(G))) – Draw only specified nodes.

  • edgelist (list (default=list(G.edges()))) – Draw only specified edges.

  • node_size (scalar or array (default=300)) – Size of nodes. If an array is specified it must be the same length as nodelist.

  • node_color (color or array of colors (default='#1f78b4')) – Node color. Can be a single color or a sequence of colors with the same length as nodelist. Color can be string or rgb (or rgba) tuple of floats from 0-1. If numeric values are specified they will be mapped to colors using the cmap and vmin,vmax parameters. See matplotlib.scatter for more details.

  • edge_color (color or array of colors (default='k')) – Edge color. Can be a single color or a sequence of colors with the same length as edgelist. Color can be string or rgb (or rgba) tuple of floats from 0-1. If numeric values are specified they will be mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.

  • {node (bool (default=True)) – If True, show color bar for node and edge colors. This is ignored if {node,edge}_color is a str.

  • edge}_cbar (bool (default = False)) – If True, show color bar for node and edge colors. This is ignored if {node,edge}_color is a str.

  • {node – Optional keyword arguments passed to matplotlib.pyplot.colorbar for the node and edge colorbars.

  • edge}_cbar_kws (dict) – Optional keyword arguments passed to matplotlib.pyplot.colorbar for the node and edge colorbars.

  • {node – Keyword arguments passed to matplotlib.pyplot.colorbar.set_ticklabels()

  • edge}_cbar_ticks_kws ({None, dict}) – Keyword arguments passed to matplotlib.pyplot.colorbar.set_ticklabels()

  • {node – Optional label for node and edge colorbar, if displayed.

  • edge}_cbar_label ({None, str}) – Optional label for node and edge colorbar, if displayed.

  • {node – Optional padding for node and edge colorbar label, if displayed.

  • edge}_cbar_labelpad ({None, int} (default = -10)) – Optional padding for node and edge colorbar label, if displayed.

  • {node – Optional y position for node and edge colorbar label, if displayed.

  • edge}_cbar_label_y ({None, float}) – Optional y position for node and edge colorbar label, if displayed.

  • {node – Colorbar label keyword arguments passed to matplotlib.pyplot.colorbar.set_label).

  • edge}_cbar_label_kws ({None, dict}) – Colorbar label keyword arguments passed to matplotlib.pyplot.colorbar.set_label).

  • node_shape (string or array of shapes (default='o')) – The shape of the node. Can be a single shape or a sequence of shapes with the same length as nodelist. Shape specification is as matplotlib.scatter marker, one of ‘os^>v<dph8’. Alternatively, to add a description of the node class represented by the shape to the legend, provide a single node class label or a sequence of node class labels with the same length as nodelist. If shape speficiations are not one of ‘os^>v<dph8’, they are treated as node class labels and are added to the legend. Use node_shape_mapper to manually specify the shape for each class.

  • node_shape_mapper (None or dict (default=None)) – A dictionary to map node class labels to shapes, keyed by node class labels that is expected to have a key for all unique node class labels in node_shape. The default is to cycle through the possible shapes ‘os^>v<dph8’, which may not be unique if there are more classes than unique markers. This is ignored if node_shape contains the shapes directly.

  • node_alpha (float, array of floats or None (default=None)) – The node transparency. This can be a single alpha value, in which case it will be applied to all the nodes of color. Otherwise, if it is an array, the elements of alpha will be applied to the colors in order (cycling through alpha multiple times if necessary).

  • edge_alpha (float or None (default=None)) – The edge transparency.

  • node_label_alpha (float or None (default=None)) – The node label text transparency

  • edge_label_alpha (float or None (default=None)) – The text transparency

  • {node – Colormap for mapping intensities of nodes and edges

  • edge}_cmap (Matplotlib colormap, optional) – Colormap for mapping intensities of nodes and edges

  • {node – Minimum and maximum for node and edge colormap scaling

  • edge}_vmin (float, optional) – Minimum and maximum for node and edge colormap scaling

  • {node – Minimum and maximum for node and edge colormap scaling

  • edge}_vmax (float, optional) – Minimum and maximum for node and edge colormap scaling

  • {node – Whether to draw lines at color boundries on node,edge colorbar. This is ignored if no colorbar is being shown. Default behavior is to draw edges for a discrete colormap and not for continuous colormaps.

  • edge}_cmap_drawedges (bool) – Whether to draw lines at color boundries on node,edge colorbar. This is ignored if no colorbar is being shown. Default behavior is to draw edges for a discrete colormap and not for continuous colormaps.

  • border_linewidths (scalar or sequence (default=1.0)) – Line width of symbol border.

  • bordercolors ([None | scalar | sequence] (default = node_color)) – Colors of node borders.

  • edge_width (float or array of floats (default=1.0)) – Line width of edges

  • edge_style (string or array of strings (default=solid line)) – Edge line style. Can be a single style or a sequence of styles with the same length as edgelist. Styles can be any of ‘-’, ‘–’, ‘-.’, ‘:’ or words like ‘solid’ or ‘dashed’. (See matplotlib.patches.FancyArrowPatch: linestyle) Alternatively, to add a description of the edge class represented by the style to the legend, provide a single edge class label or a sequence of edge class labels with the same length as edgelist. If style speficiations are not one of [‘-’, ‘–’, ‘-.’, ‘:’, ‘solid’, ‘dashed’, ‘dotted’, ‘dashdot’], they are treated as edge class labels and are added to the legend. Use edge_style_mapper to manually specify the style for each class.

  • edge_style_mapper (None or dict (default=None)) – A dictionary to map edge class labels to styles, keyed by edge class and is expected to have a key for all include all unique edge class labels in edge_style. The default is to cycle through the possible edge styles [‘-’, ‘–’, ‘-.’, ‘:’], which may not be unique if there are more classes than unique styles. This is ignored if edge_style contains the styles directly.

  • node_labels (dictionary (default=None)) – Node labels in a dictionary of text labels keyed by node

  • edge_labels (dictionary (default=None)) – Edge labels in a dictionary of labels keyed by edge two-tuple. Only labels for the keys in the dictionary are drawn.

  • {node – If True, add legend with node shape or edge style. Default is True, but this is ignored if node_shape or edge_style is not provided.

  • edge}_show_legend (bool) – If True, add legend with node shape or edge style. Default is True, but this is ignored if node_shape or edge_style is not provided.

  • legend_kws ({None, dict} (default=None)) – Keyword arguments passed to ax.legend.

  • {node – Font size for text labels

  • edge}_font_size (int (default=12 for nodes, 10 for edges)) – Font size for text labels

  • {node – Font color string

  • edge}_font_color (string (default='k' black)) – Font color string

  • {node – Font weight

  • edge}_font_weight (string (default='normal')) – Font weight

  • {node – Font family

  • edge}_font_family (string (default='sans-serif')) – Font family

  • {node – If provided, used to assign labels to numeric values in color-bar when a discrete colormap is used.

  • edge}_ticklabels_mapper ({None, dict} (default=None)) – If provided, used to assign labels to numeric values in color-bar when a discrete colormap is used.

  • node_bbox (Matplotlib bbox, (default is Matplotlib's ax.text default)) – Specify text box properties (e.g. shape, color etc.) for node labels.

  • edge_bbox (Matplotlib bbox, optional) – Specify text box properties (e.g. shape, color etc.) for edge labels. Default is {boxstyle=’round’, ec=(1.0, 1.0, 1.0), fc=(1.0, 1.0, 1.0)}.

  • {node – Horizontal alignment {‘center’, ‘right’, ‘left’}

  • edge}_horizontalalignment (string (default='center')) – Horizontal alignment {‘center’, ‘right’, ‘left’}

  • {node – Vertical alignment {‘center’, ‘top’, ‘bottom’, ‘baseline’, ‘center_baseline’}

  • edge}_verticalalignment (string (default='center')) – Vertical alignment {‘center’, ‘top’, ‘bottom’, ‘baseline’, ‘center_baseline’}

  • {node – Turn on clipping of node labels at axis boundaries

  • edge}_clip_on (bool (default=True)) – Turn on clipping of node labels at axis boundaries

  • margins (float or 2-tuple, optional) – Sets the padding for axis autoscaling. Increase margin to prevent clipping for nodes that are near the edges of an image. Values should be in the range [0, 1]. See matplotlib.axes.Axes.margins() for details. The default is None, which uses the Matplotlib default.

  • min_source_margin (int (default=0)) – The minimum margin (gap) at the begining of the edge at the source.

  • min_target_margin (int (default=0)) – The minimum margin (gap) at the end of the edge at the target.

  • edge_label_pos (float (default=0.5)) – Position of edge label along edge (0=head, 0.5=center, 1=tail)

  • rotate (bool (deafult=True)) – Rotate edge labels to lie parallel to edges

See also

networkx.draw, networkx.draw_networkx, networkx.draw_networkx_nodes, networkx.draw_networkx_edges, networkx.draw_networkx_labels, networkx.draw_networkx_edge_labels

netflow.probe.visualization.sin_layout(G_tda, d, res=0.35, h=1, period=0.39269908169872414, sep=1, root=None)[source]#

Node positions for sinusoidal layout of branches

netflow.probe.visualization.wavy_curve_layout(G_tda, d, a=0.5, b=1.5707963267948966, C=0, h=8, t_start=1.5, sep=1, root=None)[source]#

Node positions for wavy spiral layout of branches