webweb’ll display a metadata attribute as binary if every node’s value for that attribute is either True or False.

True values will be “big” and False values small, but if we want the opposite, we can do the following:

web.display.invertBinarySizes = True

showing:

from webweb import Web

web = Web(
    adjacency=[['Dan', 'Hunter'], ['Brian', 'Hunter'], ['Carl', 'Hunter'], ['Carl', 'Brian']],
    display={
        'nodes' : {
            'Dan' : {
                'wearsGlasses' : True,
            },
            'Hunter' : {
                'wearsGlasses' : True,
            },
            'Brian' : {
                'wearsGlasses' : True,
            },
            'Carl' : {
                'wearsGlasses' : False,
            },
        },
    },
)

# use the 'wearsGlasses' to compute node sizes
web.display.sizeBy = 'wearsGlasses'

web.display.colorBy = 'wearsGlasses'

# 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([['Dan', 'Hunter'], ['Brian', 'Hunter'], ['Carl', 'Hunter'], ['Carl', 'Brian']])

G.nodes['Dan']['wearsGlasses'] = True
G.nodes['Hunter']['wearsGlasses'] = True
G.nodes['Brian']['wearsGlasses'] = True
G.nodes['Carl']['wearsGlasses'] = False

# `True` values will be "big" and `False` values small, but if we wanted the
# opposite, we could do the following:
# web.display.invertBinarySizes = True

# create the web
web = Web(nx_G=G)

# use the 'wearsGlasses' to compute node sizes
web.display.sizeBy = 'wearsGlasses'

# show the visualization
web.show()
% define an edge list
edge_list = [...
    1, 2;
    2, 3;
    2, 4;
    3, 4;
    ];
% define names for the nodes
names = {'Dan','Hunter','Brian','Carl'};

% put the edge list and names into a webweb struct called ww
ww.networks.network.edgeList = edge_list;
ww.display.metadata.name.values = names;

% put some boolean metadata into the same struct
wearsGlasses = [1,1,1,0];
ww.display.metadata.wearsGlasses.values = wearsGlasses;
ww.display.metadata.wearsGlasses.type   = 'binary';

% call webweb
webweb(ww);
{
    "display": {
        "colorBy": "wearsGlasses",
        "nodes": {
            "Brian": {
                "wearsGlasses": true
            },
            "Carl": {
                "wearsGlasses": false
            },
            "Dan": {
                "wearsGlasses": true
            },
            "Hunter": {
                "wearsGlasses": true
            }
        },
        "sizeBy": "wearsGlasses"
    },
    "networks": {
        "webweb": {
            "layers": [
                {
                    "edgeList": [
                        [
                            "Dan",
                            "Hunter"
                        ],
                        [
                            "Brian",
                            "Hunter"
                        ],
                        [
                            "Carl",
                            "Hunter"
                        ],
                        [
                            "Carl",
                            "Brian"
                        ]
                    ],
                    "metadata": null,
                    "nodes": {}
                }
            ]
        }
    },
    "title": "webweb"
}