Пример #1
0
    def clean(conn, label=None):
        """
        Visualize a sparse adjacency matrix.

        .. image:: adjacency.png

        Parameters
        ----------
       conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        label : array-like, optional, singleton or (n,)
            Single integer or array to set colors via groups
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, label, 'label')

        return outdict
Пример #2
0
    def clean(conn, label=None):

        """
        Visualize a sparse adjacency matrix.

        .. image:: adjacency.png

        Parameters
        ----------
       conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        label : array-like, optional, singleton or (n,)
            Single integer or array to set colors via groups
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, label, 'label')

        return outdict
Пример #3
0
    def clean(conn, values=None, labels=None, color=None, group=None, colormap=None, size=None):
        """
        Create a force-directed network from connectivity.

        .. image:: force.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        values : array-like, optional, singleton or (n,)
            Values to set node colors via a linear scale

        labels : array-like, optional, (n,)
            Array of text labels to set tooltips

        color : array-like, optional, singleton or (n,3)
            Single rgb value or array to set node colors

        group : array-like, optional, singleton or (n,)
            Single integer or array to set node colors via group assignment

        colormap : string
            Specification of color map, only colorbrewer types supported

        size : array-like, optional, singleton or (n,)
            Single size or array to set node sizes

        tooltips : boolean, optional, default=True
            Whether to show tooltips

        zoom : boolean, optional, default=True
            Whether to allow zooming

        brush : boolean, optional, default=True
            Whether to support brushing
        """

        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, color, 'color')
        outdict = add_property(outdict, group, 'group')
        outdict = add_property(outdict, values, 'values')
        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, colormap, 'colormap')
        outdict = add_property(outdict, size, 'size')

        return outdict
Пример #4
0
    def clean(conn, values=None, labels=None, color=None, group=None, colormap=None, size=None):
        """
        Create a force-directed network from connectivity.

        .. image:: force.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        values : array-like, optional, singleton or (n,)
            Values to set node colors via a linear scale

        labels : array-like, optional, (n,)
            Array of text labels to set tooltips

        color : array-like, optional, singleton or (n,3)
            Single rgb value or array to set node colors

        group : array-like, optional, singleton or (n,)
            Single integer or array to set node colors via group assignment

        colormap : string
            Specification of color map, only colorbrewer types supported

        size : array-like, optional, singleton or (n,)
            Single size or array to set node sizes

        tooltips : boolean, optional, default=True
            Whether to show tooltips

        zoom : boolean, optional, default=True
            Whether to allow zooming

        brush : boolean, optional, default=True
            Whether to support brushing
        """

        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, color, 'color')
        outdict = add_property(outdict, group, 'group')
        outdict = add_property(outdict, values, 'values')
        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, colormap, 'colormap')
        outdict = add_property(outdict, size, 'size')

        return outdict
Пример #5
0
    def clean(conn, group=None, color=None, labels=None):
        """
        Create a circular graph from connectivity data.

        .. image:: circle.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        group : array-like, optional, (m,n) or (n,)
            Hierarchical group assignments, where m is
            the number of groups

        color : array-like, optional, singleton or (k,3)
            Single rgb value or array to set colors of top-level group,
            where k is the number of unique elements in the top-level group

        labels : array-like, optional, (n,)
            Array of text labels to label nodes
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, color, 'color')

        if group is not None:
            if isinstance(group, ndarray):
                group = group.tolist()
            if isinstance(group, list):
                if not isinstance(group[0], list):
                    if isinstance(group[0], ndarray):
                        group = [g.tolist() for g in group]
                    else:
                        group = [group]
            else:
                raise ValueError('group must be list or nested list')

            outdict['group'] = group

        return outdict
Пример #6
0
    def clean(conn, group=None, color=None, labels=None):
        """
        Create a circular graph from connectivity data.

        .. image:: circle.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        group : array-like, optional, (m,n) or (n,)
            Hierarchical group assignments, where m is
            the number of groups

        color : array-like, optional, singleton or (k,3)
            Single rgb value or array to set colors of top-level group,
            where k is the number of unique elements in the top-level group

        labels : array-like, optional, (n,)
            Array of text labels to label nodes
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, color, 'color')

        if group is not None:
            if isinstance(group, ndarray):
                group = group.tolist()
            if isinstance(group, list):
                if not isinstance(group[0], list):
                    if isinstance(group[0], ndarray):
                        group = [g.tolist() for g in group]
                    else:
                        group = [group]
            else:
                raise ValueError('group must be list or nested list')

            outdict['group'] = group

        return outdict
Пример #7
0
    def clean(conn,
              color=None,
              label=None,
              value=None,
              colormap=None,
              size=None):
        """
        Create a force-directed network from connectivity.

        .. image:: force.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        color : array-like, optional, singleton or (n,3)
            Single rgb value or array to set node colors

        label : array-like, optional, singleton or (n,)
            Single integer or array to set node colors via group labels

        value : array-like, optional, singleton or (n,)
            Values to set node colors via a linear scale

        colormap : string
            Specification of color map, only colorbrewer types supported

        size : array-like, optional, singleton or (n,)
            Single size or array to set node sizes
        """

        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, color, 'color')
        outdict = add_property(outdict, label, 'label')
        outdict = add_property(outdict, value, 'value')
        outdict = add_property(outdict, colormap, 'colormap')
        outdict = add_property(outdict, size, 'size')

        return outdict
Пример #8
0
    def clean(conn, color=None, label=None, value=None, colormap=None, size=None):
        """
        Create a force-directed network from connectivity.

        .. image:: force.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        color : array-like, optional, singleton or (n,3)
            Single rgb value or array to set node colors

        label : array-like, optional, singleton or (n,)
            Single integer or array to set node colors via group labels

        value : array-like, optional, singleton or (n,)
            Values to set node colors via a linear scale

        colormap : string
            Specification of color map, only colorbrewer types supported

        size : array-like, optional, singleton or (n,)
            Single size or array to set node sizes
        """

        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, color, 'color')
        outdict = add_property(outdict, label, 'label')
        outdict = add_property(outdict, value, 'value')
        outdict = add_property(outdict, colormap, 'colormap')
        outdict = add_property(outdict, size, 'size')

        return outdict
Пример #9
0
    def clean(conn, labels=None, group=None):
        """
        Visualize a sparse adjacency matrix.

        .. image:: adjacency.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        labels : array-like, (n,)
            Text labels for each item (will label rows and columns)

        group : array-like, optional, singleton or (n,)
            Single integer or array to set colors via groups

        sort : str, optional, default='group'
            What to sort by, options are 'group' | 'degree'

        numbers : boolean, optional, default=False
            Whether to show numbers on cells

        symmetric : boolean, optional, default=True
            Whether to make links symmetrical
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, group, 'group')

        return outdict
Пример #10
0
    def clean(conn, labels=None, group=None):
        """
        Visualize a sparse adjacency matrix.

        .. image:: adjacency.png

        Parameters
        ----------
        conn : array-like, (n,n) or (n,3) or (n,2)
            Input connectivity data as either a matrix or a list of links.
            Matrix can be binary or continuous valued. Links should contain
            either 2 elements per link (source, target),
            or 3 elements (source, target, value).

        labels : array-like, (n,)
            Text labels for each item (will label rows and columns)

        group : array-like, optional, singleton or (n,)
            Single integer or array to set colors via groups

        sort : str, optional, default='group'
            What to sort by, options are 'group' | 'degree'

        numbers : boolean, optional, default=False
            Whether to show numbers on cells

        symmetric : boolean, optional, default=True
            Whether to make links symmetrical
        """
        links = parse_links(conn)
        nodes = parse_nodes(conn)

        outdict = {'links': links, 'nodes': nodes}

        outdict = add_property(outdict, labels, 'labels')
        outdict = add_property(outdict, group, 'group')

        return outdict