Skip to content

showOccupancies should support atoms kwarg or extract them from ensemble #1590

Description

@jamesmkrieger

At the moment, it just uses plt.plot and gives this error if we try to use them:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-214-67a022bd432d> in <module>
----> 1 showOccupancies(dali_ens, normed=True, atoms=dali_ens.getAtoms())
      2 plt.ylim([0, 1.1])

/mnt/c/Users/james/code/ProDy/prody/ensemble/functions.py in showOccupancies(pdbensemble, *args, **kwargs)
    333     if weights is None:
    334         return None
--> 335     show = plt.plot(weights, *args, **kwargs)
    336     axis = list(plt.axis())
    337     axis[2] = 0

~/anaconda3/lib/python3.8/site-packages/matplotlib/pyplot.py in plot(scalex, scaley, data, *args, **kwargs)
   2838 @_copy_docstring_and_deprecators(Axes.plot)
   2839 def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
-> 2840     return gca().plot(
   2841         *args, scalex=scalex, scaley=scaley,
   2842         **({"data": data} if data is not None else {}), **kwargs)

~/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, data, *args, **kwargs)
   1741         """
   1742         kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1743         lines = [*self._get_lines(*args, data=data, **kwargs)]
   1744         for line in lines:
   1745             self.add_line(line)

~/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in __call__(self, data, *args, **kwargs)
    271                 this += args[0],
    272                 args = args[1:]
--> 273             yield from self._plot_args(this, kwargs)
    274 
    275     def get_next_color(self):

~/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
    416         if ncx > 1 and ncy > 1 and ncx != ncy:
    417             raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
--> 418         return [func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
    419                 for j in range(max(ncx, ncy))]
    420 

~/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in <listcomp>(.0)
    416         if ncx > 1 and ncy > 1 and ncx != ncy:
    417             raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
--> 418         return [func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
    419                 for j in range(max(ncx, ncy))]
    420 

~/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in _makeline(self, x, y, kw, kwargs)
    310         default_dict = self._getdefaults(set(), kw)
    311         self._setdefaults(default_dict, kw)
--> 312         seg = mlines.Line2D(x, y, **kw)
    313         return seg
    314 

~/anaconda3/lib/python3.8/site-packages/matplotlib/lines.py in __init__(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs)
    388         # update kwargs before updating data to give the caller a
    389         # chance to init axes (and hence unit support)
--> 390         self.update(kwargs)
    391         self.pickradius = pickradius
    392         self.ind_offset = 0

~/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in update(self, props)
    994                     func = getattr(self, f"set_{k}", None)
    995                     if not callable(func):
--> 996                         raise AttributeError(f"{type(self).__name__!r} object "
    997                                              f"has no property {k!r}")
    998                     ret.append(func(v))

AttributeError: 'Line2D' object has no property 'atoms'

Metadata

Metadata

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