graphlet_stack_plot

graphlet_stack_plot(netin, ax, q=10, cmap='Reds', gridcolor='k', borderwidth=2, bordercolor=None, Fs=1, timeunit='', t0=1, sharpen='yes', vminmax='minmax')[source]

Returns matplotlib axis handle for graphlet_stack_plot. This is a row of transformed connectivity matrices to look like a 3D stack.

Parameters:
  • netin (array, dict) – network input (graphlet or contact)
  • ax (matplotlib ax handles.) –
  • q (int) – Quality. Increaseing this will lead to smoother axis but take up more memory.
  • cmap (str) – Colormap (matplotlib) of graphlets
  • Fs (int) – Sampling rate. Same as contact-representation (if netin is contact, and input is unset, contact dictionary is used)
  • timeunit (str) – Unit of time for xlabel. Same as contact-representation (if netin is contact, and input is unset, contact dictionary is used)
  • t0 (int) – What should the first time point be called. Should be integer. Default 1.
  • gridcolor (str) – The color of the grid section of the graphlets. Set to ‘none’ if not wanted.
  • borderwidth (int) – Scales the size of border.
  • bordorcolor – color of the border (at the moment it must be in RGB values between 0 and 1 -> this will be changed sometime in the future). Default: black.
  • vminmax (str) – ‘maxabs’, ‘minmax’ (default), or list/array with length of 2. Specifies the min and max colormap value of graphlets. Maxabs entails [-max(abs(G)),max(abs(G))], minmax entails [min(G), max(G)].
Returns:

ax

Return type:

matplotlib ax handle

Note

This function can require a lot of RAM with larger networks.

Note

At the momenet bordercolor cannot be set to zero. To remove border, set bordorwidth=1 and bordercolor=[1,1,1] for temporay workaround.

Examples

Create a network with some metadata

>>> import numpy as np
>>> import teneto
>>> import matplotlib.pyplot as plt
>>> np.random.seed(2017) # For reproduceability
>>> N = 5 # Number of nodes
>>> T = 10 # Number of timepoints
>>> # Probability of edge activation
>>> birth_rate = 0.2
>>> death_rate = .9
>>> # Add node names into the network and say time units are years, go 1 year per
graphlet and startyear is 2007
>>> cfg={}
>>> cfg['Fs'] = 1
>>> cfg['timeunit'] = 'Years'
>>> cfg['t0'] = 2007 #First year in network
>>> #Generate network
>>> C = teneto.generatenetwork.rand_binomial([N,T],[birth_rate, death_rate],'contact','bu',netinfo=cfg)

Now this network can be plotted

>>> fig,ax = plt.subplots(figsize=(10,3))
>>> ax = teneto.plot.graphlet_stack_plot(C,ax,q=10,cmap='Greys')
>>> fig.show()

(Source code, png, hires.png, pdf)

../_images/teneto-plot-graphlet_stack_plot-1.png