Skip to content

Unable to draw more than one gene in the same plot #11

Description

@fbrundu

Hi,
I receive the following error while trying to draw a list of genes, probably due to changes in the underlying matplotlib API:

c.draw(['GRIA1', 'SLC1A3']);

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-36-4449e82bda2b> in <module>()
----> 1 c.draw(['GRIA1','SLC1A3']);

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/scTDA/main.pyc in draw(self, color, connected, labels, ccmap, weight, save, ignore_log, table, axis, a)
   1230             values = [(1.0-colorb[node]/bmax, max(1.0-(colorr[node]/rmax+colorb[node]/bmax), 0.0),
   1231                        1.0-colorr[node]/rmax) for node in pg.nodes()]
-> 1232             networkx.draw_networkx_nodes(pg, pos, node_color=values, node_size=sizes)
   1233             polca = [(colorr[node], colorb[node]) for node in pg.nodes()]
   1234         elif type(color) == list and len(color) == 3:

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/networkx/drawing/nx_pylab.pyc in draw_networkx_nodes(G, pos, nodelist, node_size, node_color, node_shape, alpha, cmap, vmin, vmax, ax, linewidths, edgecolors, label, **kwds)
    412                                  linewidths=linewidths,
    413                                  edgecolors=edgecolors,
--> 414                                  label=label)
    415 
    416     node_collection.set_zorder(2)

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1853                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1854                         RuntimeWarning, stacklevel=2)
-> 1855             return func(ax, *args, **kwargs)
   1856 
   1857         inner.__doc__ = _add_data_doc(inner.__doc__,

/Users/user/.pyenv/versions/2.7.15/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
   4277                 raise ValueError("c of shape {} not acceptable as a color "
   4278                                  "sequence for x with size {}, y with size {}"
-> 4279                                  .format(c.shape, x.size, y.size))
   4280         else:
   4281             colors = None  # use cmap, norm after collection is created

AttributeError: 'list' object has no attribute 'shape'

c is an UnrootedGraph initialized through Ayasdi.

Versions

scTDA==0.97
matplotlib==2.2.2
networkx==2.1


Francesco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions