Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fbrundu opened this issue Jul 6, 2018 · 2 comments
Open

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

fbrundu opened this issue Jul 6, 2018 · 2 comments

Comments

@fbrundu
Copy link
Contributor

fbrundu commented Jul 6, 2018

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

@fbrundu
Copy link
Contributor Author

fbrundu commented Jul 6, 2018

I solved by installing graphviz and pygraphviz (homebrew and pip):

brew install graphviz
pip install --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz

@fbrundu fbrundu closed this as completed Jul 6, 2018
@fbrundu
Copy link
Contributor Author

fbrundu commented Jul 6, 2018

Actually I just found that works only with some list of genes and not with others..

Update

It works with

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

but not with

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

@fbrundu fbrundu reopened this Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant