milkviz.graph#

milkviz.graph(edges: List[Tuple[Any, Any]], nodes: Optional[List] = None, nodes_size: Optional[List[float]] = None, nodes_color: Optional[Union[List[float], List[str], str]] = '#69B0AC', edges_width: Optional[List[float]] = None, edges_color: Optional[Union[List[float], List[str], str]] = '#F7C242', nodes_size_range: Optional[Tuple[float, float]] = None, nodes_color_range: Optional[Tuple[float, float]] = None, edges_width_range: Optional[Tuple[float, float]] = None, edges_color_range: Optional[Tuple[float, float]] = None, node_cmap: Optional[str] = 'Purples', edge_cmap: Optional[str] = 'RdBu', node_cbar_kw: Optional[Dict] = None, edge_cbar_kw: Optional[Dict] = None, sizes: Tuple[float, float] = (100, 1500), node_shape: str = 'o', linewidth: Tuple[float, float] = (1, 10), connectionstyle: str = 'arc3,rad=0.2', layout: str = 'kamada_kawai_layout', arrowstyle: str = '-', ax: Optional[Axes] = None) Axes#

Graph layout

Parameters
  • nodes – The graph nodes, a list of nodes

  • edges – The graph data, a list of (source, target)

  • nodes_size – The size array that map to marker sizes

  • nodes_color – The color array that map to marker colors

  • edges_width – The width array that map to edges width

  • edges_color – The color array that map to edges color

  • nodes_size_range – Use to remap the nodes size, overwrite the min, max of nodes_size array

  • nodes_color_range – Use to remap the nodes colors, overwrite the min, max of nodes_color array

  • edges_width_range – Use to remap the edges width, overwrite the min, max of nodes_size array

  • edges_color_range – Use to remap the edges colors, overwrite the min, max of edges_color array

  • node_cmap – The colormap for node

  • edge_cmap – The colormap for edge

  • node_cbar_kw – To control the cbar of node

  • edge_cbar_kw – To control the cbar of edge

  • sizes – The size range of circle markers, (min, max)

  • node_shape – The shape of the node. Specification is as matplotlib.scatter marker, one of ‘so^>v<dph8’.

  • linewidth – Line width of symbol border

  • connectionstyle – Pass the connectionstyle parameter to create curved arc of rounding radius rad. For example, connectionstyle=’arc3,rad=0.2’. See matplotlib.patches.ConnectionStyle and matplotlib.patches.FancyArrowPatch for more info.

  • layout – See networkx.drawing.layout

  • arrowstyle – For directed graphs and arrows==True defaults to ‘-|>’, See matplotlib.patches.ArrowStyle for more options.

  • ax – Pre-existing axes for the plot. Or a new one will be created.

Returns

A matplotlib.axes.Axes instance