Closed wiheto closed 1 year ago
Following code
import netplotbrain import pandas as pd edges = pd.read_csv('./examples/example_edges.tsv', sep='\t', index_col=0) nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) netplotbrain.plot(template='MNI152NLin2009cAsym', view='LS', templatestyle='glass', nodes=nodes, edges=edges, nodecolor='community')
Leads to an error message:
TypeError Traceback (most recent call last) Input In [11], in <cell line: 7>() 4 edges = pd.read_csv('./examples/example_edges.tsv', sep='\t', index_col=0) 5 nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) ----> 7 netplotbrain.plot(template='MNI152NLin2009cAsym', view='LS', templatestyle='glass', nodes=nodes, edges=edges, nodecolor='community') File ~/packages/netplotbrain/netplotbrain/plot.py:261, in plot(nodes, fig, ax, view, frames, edges, template, templatestyle, network, arrowaxis, arroworigin, edgecolor, nodesize, nodecolor, nodetype, nodecmap, edgecmap, edgeweights, nodes_df, hemisphere, title, highlightnodes, highlightedges, showlegend, **kwargs) 259 else: 260 legend_subplotp_colind = int(np.round(spind / 2) - 1) --> 261 ax = fig.add_subplot(gridspec[nrows + li, legend_subplotp_colind]) 262 if legend == 'nodesize': 263 ax = _add_nodesize_legend(ax, nodes, nodesize, **profile) File ~/anaconda3/lib/python3.9/site-packages/matplotlib/gridspec.py:257, in GridSpecBase.__getitem__(self, key) 254 except ValueError as err: 255 raise ValueError("Unrecognized subplot spec") from err 256 num1, num2 = np.ravel_multi_index( --> 257 [_normalize(k1, nrows, 0), _normalize(k2, ncols, 1)], 258 (nrows, ncols)) 259 else: # Single key 260 num1, num2 = _normalize(key, nrows * ncols, None) File ~/anaconda3/lib/python3.9/site-packages/matplotlib/gridspec.py:240, in GridSpecBase.__getitem__.<locals>._normalize(key, size, axis) 237 raise IndexError("GridSpec slice would result in no space " 238 "allocated for subplot") 239 else: --> 240 if key < 0: 241 key = key + size 242 if 0 <= key < size: TypeError: '<' not supported between instances of 'list' and 'int'
No error if nodecolor is not specified or string to views is 1 or 3 in length.
Following code
Leads to an error message:
No error if nodecolor is not specified or string to views is 1 or 3 in length.