Plotting module#

Plotting functions.

pygenstability.plotting.plot_scan(all_results, scale_axis=True, figure_name='scan_results.pdf', use_plotly=False, live=True, plotly_filename='scan_results.html')[source]#

Plot results of pygenstability with matplotlib or plotly.

Parameters:
  • all_results (dict) – results of pygenstability scan

  • scale_axis (bool) – display scale of scale index on scale axis

  • figure_name (str) – name of matplotlib figure

  • use_plotly (bool) – use matplotlib or plotly backend

  • live (bool) – for plotly backend, open browser with pot

  • plotly_filename (str) – filename of .html figure from plotly

pygenstability.plotting.plot_scan_plotly(all_results, live=False, filename='clusters.html')[source]#

Plot results of pygenstability with plotly.

pygenstability.plotting.plot_single_partition(graph, all_results, scale_id, edge_color='0.5', edge_width=0.5, node_size=100)[source]#

Plot the community structures for a given scale.

Parameters:
  • graph (networkx.Graph) – graph to plot

  • all_results (dict) – results of pygenstability scan

  • scale_id (int) – index of scale to plot

  • folder (str) – folder to save figures

  • edge_color (str) – color of edges

  • edge_width (float) – width of edges

  • node_size (float) – size of nodes

  • ext (str) – extension of figures files

pygenstability.plotting.plot_optimal_partitions(graph, all_results, edge_color='0.5', edge_width=0.5, folder='optimal_partitions', ext='.pdf', show=False)[source]#

Plot the community structures at each optimal scale.

Parameters:
  • graph (networkx.Graph) – graph to plot

  • all_results (dict) – results of pygenstability scan

  • edge_color (str) – color of edges

  • edge_width (float) – width of edgs

  • folder (str) – folder to save figures

  • ext (str) – extension of figures files

  • show (bool) – show each plot with plt.show() or not

pygenstability.plotting.plot_communities(graph, all_results, folder='communities', edge_color='0.5', edge_width=0.5, ext='.pdf')[source]#

Plot the community structures at each scale in a folder.

Parameters:
  • graph (networkx.Graph) – graph to plot

  • all_results (dict) – results of pygenstability scan

  • folder (str) – folder to save figures

  • edge_color (str) – color of edges

  • edge_width (float) – width of edgs

  • ext (str) – extension of figures files

pygenstability.plotting.plot_communities_matrix(graph, all_results, folder='communities_matrix', ext='.pdf')[source]#

Plot communities at all scales in matrix form.

Parameters:
  • graph (array) – as a numpy matrix

  • all_results (dict) – clustring results

  • folder (str) – folder to save figures

  • ext (str) – figure file format

pygenstability.plotting.plot_scan_plt(all_results, scale_axis=True, figure_name='scan_results.svg')[source]#

Plot results of pygenstability with matplotlib.

pygenstability.plotting.plot_clustered_adjacency(adjacency, all_results, scale, labels=None, figsize=(12, 10), cmap='Blues', figure_name='clustered_adjacency.pdf')[source]#

Plot the clustered adjacency matrix of the graph at a given scale.

Parameters:
  • adjacency (ndarray) – adjacency matrix to plot

  • all_results (dict) – results of PyGenStability

  • scale (int) – scale index for clustering

  • labels (list) – node labels, or None

  • figsize (tubple) – figure size

  • cmap (str) – colormap for matrix elements

  • figure_name (str) – filename of the figure with extension