if the set of a metadata attribute’s values contains strings (like cooperativity here), webweb’ll display it as a categorical attribute.

if that set is all numbers (like alphabeticallity here), you should tell webweb how to display it by adding that metadata attribute name to the metadata key to the display attribute with an array under categories; a node’s value for this metadata attribute should be an index into this array.

showing:

from webweb import Web

web = Web(
    adjacency=[[0, 1], [1, 2]],
    display={
        'nodes' : {
            0 : {
                'cooperativity' : 'high',
                'alphabeticallity' : 0,
            },
            1 : {
                'cooperativity' : 'low',
                'alphabeticallity' : 1,
            },
            2 : {
                'cooperativity' : 'medium',
                'alphabeticallity' : 2,
            },
        },
        'metadata' : {
            'alphabeticallity' : {
                'categories' : ['A-Z', 'a-z', 'W+'],
            }
        },
    },
)

# we'll compute node color by the `alphabeticallity` metadata attribute
# (categorical metadata can't be used to compute node sizes)
web.display.colorBy = 'alphabeticallity'

# show the visualization
web.show()
from webweb import Web
import networkx as nx

# webweb'll display a metadata attribute as binary if every node's value for
# that attribute is either True or False.
G = nx.Graph()
G.add_edges_from([[0, 1], [1, 2]])

G.nodes[0]['cooperativity'] = 'high'
G.nodes[0]['alphabeticallity'] = 0

G.nodes[1]['cooperativity'] = 'low'
G.nodes[1]['alphabeticallity'] = 1

G.nodes[2]['cooperativity'] = 'medium'
G.nodes[2]['alphabeticallity'] = 2

# if the set of a metadata attribute's values contains strings (like
# 'cooperativity' here), webweb'll display it as a categorical variable.

# if that set contains numbers (like 'alphabeticallity' here), you should tell
# webweb how to display it by adding that metadata attribute name to the
# `metadataInfo` key to the `display` attribute with an array under
# `categories`; a node's value for this metadata attribute should be an index
# into this array.
web = Web(
    nx_G=G,
    display={
        'metadataInfo' : {
            'alphabeticallity' : {
                'categories' : ['A-Z', 'a-z', 'W+'],
            }
        },
    }
)

# we'll compute node color by the `alphabeticallity` metadata attribute
# (categorical metadata can't be used to compute node sizes)
web.display.colorBy = 'alphabeticallity'

# show the visualization
web.show()
% define a couple edges
edges = [...
    1,2;
    2,3;...
    ];
% place the edges in a webweb struct called ww
ww.networks.network.edgeList = edges;

% Define categorical metadata sets in TWO different ways
% 1. Categories defined by integers with a set of integer-assigned keys
alphabeticallity = [1,2,3];
alphabeticallity_keys = {'A-Z','a-z','W+;'};
ww.display.metadata.alphabeticallity.values = alphabeticallity;
ww.display.metadata.alphabeticallity.categories = alphabeticallity_keys;
% 2. Categories defined directly by strings
cooperativity = {'high','medium','low'};
ww.display.metadata.cooperativity.values = cooperativity;

% BONUS: ask webweb to default to present colors by alphabeticallity
% This assignment simply needs to match the key of the metadata above.
ww.display.colorBy = 'alphabeticallity';

% call webweb
webweb(ww);
{
    "display": {
        "colorBy": "alphabeticallity",
        "metadata": {
            "alphabeticallity": {
                "categories": [
                    "A-Z",
                    "a-z",
                    "W+"
                ]
            }
        },
        "nodes": {
            "0": {
                "alphabeticallity": 0,
                "cooperativity": "high"
            },
            "1": {
                "alphabeticallity": 1,
                "cooperativity": "low"
            },
            "2": {
                "alphabeticallity": 2,
                "cooperativity": "medium"
            }
        }
    },
    "networks": {
        "webweb": {
            "layers": [
                {
                    "edgeList": [
                        [
                            0,
                            1
                        ],
                        [
                            1,
                            2
                        ]
                    ],
                    "metadata": null,
                    "nodes": null
                }
            ]
        }
    },
    "title": "webweb"
}