# neurostatx.network.viz

*module*

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L1-L1)

## neurostatx.network.viz.NetworkLayout

*class*

```python
class NetworkLayout(StrEnum, Enum)
```

Bases: `StrEnum`, `Enum`

NetworkX layout names used when placing graph nodes.

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L8-L13)

### neurostatx.network.viz.NetworkLayout.KamadaKawai

*attribute* · *class attribute* · *instance attribute*

```python
KamadaKawai = ('kamada_kawai_layout')
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L11-L11)

### neurostatx.network.viz.NetworkLayout.Spectral

*attribute* · *class attribute* · *instance attribute*

```python
Spectral = ('spectral_layout')
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L12-L12)

### neurostatx.network.viz.NetworkLayout.Spring

*attribute* · *class attribute* · *instance attribute*

```python
Spring = 'spring_layout'
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L13-L13)

## neurostatx.network.viz.create_cmap_from_list

*function*

```python
def create_cmap_from_list(array)
```

Map per-subject values to node colors.

Integer zeros are drawn as ``"darkgrey"``; other integers use ``tab10``.
Float arrays are ranked and mapped through ``plasma``.

**Parameters**

- `array` (`np.array`) — Per-subject values. Integers are treated as discrete conditions; floats are treated as a continuous scale.

**Returns**

- `nodes_cmap` (`list`) — Color for each subject.

**Examples**

```pycon
>>> import numpy as np
>>> from neurostatx.network.viz import create_cmap_from_list
>>> colors = create_cmap_from_list(np.array([0, 1, 2]))
>>> colors[0]
'darkgrey'
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L121-L166)

## neurostatx.network.viz.creating_node_colormap

*function*

```python
def creating_node_colormap(percentile_dict)
```

Map each node to a color from its highest percentile cluster.

**Parameters**

- `percentile_dict` (`dict`) — Mapping of cluster keys to per-node percentile arrays.

**Returns**

- `nodes_cmap` (`list`) — Color for each node. Nodes with a max of 0 are ``"black"``.

**Examples**

```pycon
>>> from neurostatx.network.viz import creating_node_colormap
>>> colors = creating_node_colormap({"c1": [0, 1], "c2": [0, 0]})
>>> colors[0]
'black'
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L85-L118)

## neurostatx.network.viz.membership_distribution

*function*

```python
def membership_distribution(mat, output='./membership_distribution.png')
```

Write histograms of top membership values and their delta.

**Parameters**

- `mat` (`array`) — Fuzzy membership matrix with one row per subject.
- `output` (`str`) (default: `'./membership_distribution.png'`) — Output filename. Defaults to ``"./membership_distribution.png"``.

**Examples**

```pycon
>>> import numpy as np
>>> from neurostatx.network.viz import membership_distribution
>>> mat = np.array([[0.8, 0.2], [0.3, 0.7]])
>>> membership_distribution(mat, output="membership.png")
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/network/viz.py#L16-L82)
