msticpy.vis.network_plot module

Module for common display functions.

msticpy.vis.network_plot.plot_entity_graph(entity_graph: networkx.Graph, node_size: int = 25, font_size: int | str = 10, height: int = 800, width: int = 800, scale: int = 2, hide: bool = False) figure

Plot entity graph with Bokeh.

Parameters:
  • entity_graph (nx.Graph) – The entity graph as a networkX graph

  • node_size (int, optional) – Size of the nodes in pixels, by default 25

  • font_size (int, optional) – Font size for node labels, by default 10 Can be an integer (point size) or a string (e.g. “10pt”)

  • width (int, optional) – Width in pixels, by default 800

  • height (int, optional) – Image height (the default is 800)

  • scale (int, optional) – Position scale (the default is 2)

  • hide (bool, optional) – Don’t show the plot, by default False. If True, just return the figure.

Returns:

The network plot.

Return type:

bokeh.plotting.figure

msticpy.vis.network_plot.plot_nx_graph(nx_graph: networkx.Graph, title: str = 'Data Graph', node_size: int = 25, font_size: int | str = 10, height: int = 800, width: int = 800, scale: int = 2, hide: bool = False, source_attrs: Iterable[str] | None = None, target_attrs: Iterable[str] | None = None, edge_attrs: Iterable[str] | None = None, layout: Callable[[Any], Dict[str, Tuple[float, float]]] | typing_extensions.Literal[spring, bipartite, circular, kamada_kawai, planar, random, shell, spectral, spiral, multi_partite] | Dict[str, Tuple[float, float]] = 'spring', **kwargs) figure

Plot entity graph with Bokeh.

Parameters:
  • nx_graph (nx.Graph) – The entity graph as a networkX graph

  • title (str) – Title for the plot, by default ‘Data Graph’

  • node_size (int, optional) – Size of the nodes in pixels, by default 25

  • font_size (int, optional) – Font size for node labels, by default 10 Can be an integer (point size) or a string (e.g. “10pt”)

  • width (int, optional) – Width in pixels, by default 800

  • height (int, optional) – Image height (the default is 800)

  • scale (int, optional) – Position scale (the default is 2)

  • hide (bool, optional) – Don’t show the plot, by default False. If True, just return the figure.

  • source_attrs (Optional[List[str]], optional) – Optional list of source attributes to use as hover properties, by default None

  • target_attrs (Optional[List[str]], optional) – Optional list of target attributes to use as hover properties, by default None

  • edge_attrs (Optional[List[str]], optional) – Optional list of edge attributes to use as hover properties, by default None

  • layout (GraphLayout, optional) – The layout name to use, a callable that will return layout positions, a dictionary of {nFode_id: (float, float)} node positions. The default is “spring”. See https://networkx.org/documentation/stable/reference/drawing.html

  • source_color (str, optional) – The color of the source nodes, by default ‘light-blue’

  • target_color (str, optional) – The color of the source nodes, by default ‘light-green’

  • edge_color (str, optional) – The color of the edges, by default ‘black’

  • kwargs – Additional keyword arguments are passed to the networkx layout function.

Returns:

The network plot.

Return type:

bokeh.plotting.figure