Tools for visualization of time-series data.
Depends on matplotlib. Some functions depend also on networkx
Draw arrows on a set of edges
Draw a weighted graph with options to visualize link weights.
The resulting diagram uses the rank of each node as its size, and the weight of each link (after discarding thresholded values, see below) as the link opacity.
It maps edge weight to color as well as line opacity and thickness, allowing the color part to be hardcoded over a value range (to permit valid cross-figure comparisons for different graphs, so the same color corresponds to the same link weight even if each graph has a different range of weights). The nodes sizes are proportional to their degree, computed as the sum of the weights of all their links. The layout defaults to circular, but any nx layout function can be passed in, as well as a statically precomputed layout.
Parameters : | G : weighted graph
labels : list or dict, optional.
node_colors : list or dict, optional.
node_shapes : list or dict, optional.
node_scale : float, optional
edge_style : string, optional
edge_cmap : matplotlib colormap, optional.
colorbar : bool
vrange : pair of floats
layout : function or layout dict, optional
title : string, optional.
font_family : string, optional.
font_size : int, optional.
stretch_factor : float, optional
edge_alpha: bool, optional :
fig_size: list of height by width, the size of the figure (in : inches). Defaults to [6,6] : |
---|---|
Returns : | fig :
|
Draw a matrix, optionally thresholding it.
Draw the edges of the graph G
This draws only the edges of the graph G.
pos is a dictionary keyed by vertex with a two-tuple of x-y positions as the value. See networkx.layout for functions that compute node positions.
edgelist is an optional list of the edges in G to be drawn. If provided, only the edges in edgelist will be drawn.
edgecolor can be a list of matplotlib color letters such as ‘k’ or ‘b’ that lists the color of each edge; the list must be ordered in the same way as the edge list. Alternatively, this list can contain numbers and those number are mapped to a color scale using the color map edge_cmap. Finally, it can also be a list of (r,g,b) or (r,g,b,a) tuples, in which case these will be used directly to color the edges. If the latter mode is used, you should not provide a value for alpha, as it would be applied globally to all lines.
For directed graphs, ‘arrows’ (actually just thicker stubs) are drawn at the head end. Arrows can be turned off with keyword arrows=False.
See draw_networkx for the list of other optional parameters.
Draw a graph based on the matrix specified in in_m. Wrapper to draw_graph.
Parameters : | in_m: nxn array with values of relationships between two sets of channels : or channels : channel_names (optional): list of strings with the labels to be applied to : the channels in the input. Defaults to ‘0’,‘1’,‘2’, etc. : cmap (optional): a matplotlib colormap to be used for displaying the values : of the connections on the graph : node_shapes: defaults to circle : node_colors: defaults to white, : title: : layout, defaults to nx.circular_layout : Returns : ——- : fig: a figure object : |
---|
Notes
The layout of the graph is done using functions from networkx (http://networkx.lanl.gov), which is a dependency of this function
Creates a lower-triangle of the matrix of an nxn set of values. This is the typical format to show a symmetrical bivariate quantity (such as correlation or coherence between two different ROIs).
Parameters : | in_m: nxn array with values of relationships between two sets of rois or : channels : channel_names (optional): list of strings with the labels to be applied to : the channels in the input. Defaults to ‘0’,‘1’,‘2’, etc. : fig (optional): a matplotlib figure : cmap (optional): a matplotlib colormap to be used for displaying the values : of the connections on the graph : title (optional): string to title the figure (can be like ‘$alpha$’) : color_anchor (optional): determine the mapping from values to colormap :
|
---|---|
Returns : | fig: a figure object : |
Creates an image of the time-series, ordered according to the first dimension of the time-series object
Parameters : | time_series: a nitime time-series object : fig: a figure handle, opens a new figure if None : axis: an axis number (if there are several in the figure to be opened), :
xtick_n: int, optional, sets the number of ticks to be placed on the x axis : |
---|
Make a weighted graph object out of an adjacency matrix.
The values in the original matrix cmat can be thresholded out. If only one threshold is given, all values below that are omitted when creating edges. If two thresholds are given, then values in the th2-th1 range are ommitted. This allows for the easy creation of weighted graphs with positive and negative values where a range of weights around 0 is omitted.
Parameters : | cmat : 2-d square array
threshold : float
threshold2 : float
|
---|---|
Returns : | G : a NetworkX weighted graph object, to which a dictionary called G.metadata is appended. This dict contains the original adjacency matrix : cmat, the two thresholds, and the weights : |
Show the differences in Fischer-transformed snr correlations for two time-series
Parameters : | tseries1, tseries2 : nitime TimeSeries objects
lb,ub: float :
fig: matplotlib figure object :
ts_names: list of str :
bandwidth, adaptive, low_bias: See :func:`SNRAnalyzer` for details : |
---|---|
Returns : | fig: a matplotlib figure object : |
Show the coherence, snr and information of an SNRAnalyzer
Parameters : | tseries: nitime TimeSeries object :
lb,ub: float :
|
---|---|
Returns : | A tuple containing: : fig: a matplotlib figure object :
|
Show distributions of differences between two time-series in the amount of snr (freq band by freq band) and information. For example, for comparing two stimulus conditions
Parameters : | tseries1, tseries2 : nitime TimeSeries objects
lb,ub: float :
fig: matplotlib figure object :
ts_names: list of str :
bandwidth, adaptive, low_bias: See :func:`nta.SNRAnalyzer` for details : |
---|---|
Returns : | A tuple containing: : fig: a matplotlib figure object :
info1, info2: float arrays :
s_n_r1, s_n_r2: float arrays :
|
Plot an estimate of a spectral transform against the ground truth.
Utility file used in building the documentation
plot a timeseries object
Visualize the cross-correlation function
Returns the part of cmap between xmin, xmax, scaled to 0,1.
Inspect a window by showing it and its spectrum
Utility file used in building the documentation