pyemma.plots.NetworkPlot

class pyemma.plots.NetworkPlot(A, pos=None, xpos=None, ypos=None, ax=None)

Plot of network with nodes and arcs

__init__(A, pos=None, xpos=None, ypos=None, ax=None)
Parameters
  • A (ndarray(n,n)) – weight matrix or adjacency matrix of the network to visualize

  • pos (ndarray(n,2)) – user-defined positions

  • xpos (ndarray(n,)) – user-defined x-positions

  • ypos (ndarray(n,)) – user-defined y-positions

  • ax (matplotlib Axes object, optional, default=None) – The axes to plot to. When set to None a new Axes (and Figure) object will be used.

Examples

We define first define a reactive flux by taking the following transition matrix and computing TPT from state 2 to 3.

>>> import numpy as np
>>> P = np.array([[0.8,  0.15, 0.05,  0.0,  0.0],
...               [0.1,  0.75, 0.05, 0.05, 0.05],
...               [0.05,  0.1,  0.8,  0.0,  0.05],
...               [0.0,  0.2, 0.0,  0.8,  0.0],
...               [0.0,  0.02, 0.02, 0.0,  0.96]])
>>> from pyemma import msm
>>> F = msm.tpt(msm.markov_model(P), [2], [3])

now plot the gross flux >>> NetworkPlot(F.gross_flux).plot_network() # doctest: +ELLIPSIS <…Figure…

Methods

__init__(A[, pos, xpos, ypos, ax])

param A

weight matrix or adjacency matrix of the network to visualize

layout_automatic()

plot_network([state_sizes, state_scale, …])

Draws a network using discs and curved arrows.

plot_network(state_sizes=None, state_scale=1.0, state_colors='#ff5500', state_labels='auto', arrow_scale=1.0, arrow_curvature=1.0, arrow_labels='weights', arrow_label_format='%10.2f', max_width=12, max_height=12, figpadding=0.2, xticks=False, yticks=False, show_frame=False, **textkwargs)

Draws a network using discs and curved arrows.

The thicknesses and labels of the arrows are taken from the off-diagonal matrix elements in A.