AlloViz.AlloViz.Elements.Element.view

Element.view(metric, num=20, colors=['orange', 'turquoise'], nv=None)[source]

Represent the selected metric in the structure

Retrieves the analyzed data corresponding to the present Element (depending on the class) and from it the corresponding metric column from the DataFrame. It is used to obtain the elements’ colors, sizes (inv. proportional to errors, if available) and names (resnames); and the parent instance attribute is used to retrieve the structure for representation using nglview.NGLWidget.

Data is sorted according to the selected metric in absolute value and descending order, a LinearSegmentedColormap is made with the passed colors. The colormap is represented in a colorbar through _show_cbar() and is used to establish the elements’ colors through _get_colors().

Errors, if available (i.e., if more than one trajectory has been used and averages were calculated), are used to establish the elements’ sizes to be inversely proportional to them (interpolated between 1 and 0.1), thus directly proportional to the “confidence” in the calculated value in a way.

Elements are shown on a representation of the selected structure or added to the passed NGLWidget if applicable.

Parameters:
metricstr

Metric/Name of the column in the object’s df attribute to represent.

numint, default: 20

Number of (each of the) network elements to show on the structure.

colorslist, default: [“orange”, “turquoise”]

List of two colors to assign to the minimum and maximum values of the network to be represented, respectively. Middle value is assigned “white” and it will be the mean of the network values or 0 if the network has both negative and positive values.

nvnglview.NGLWidget, optional

A structure representation into which the shapes representing the chosen network elements will be added.