msultan / SML_CV

Using supervised machine learning to build collective variables for accelerated sampling
MIT License
27 stars 5 forks source link

error in chignolin_example #2

Closed roadhouse23 closed 5 years ago

roadhouse23 commented 5 years ago

Hello, when I try to execute the svm_chignolin.py example, I got the following error:

"TypeError Traceback (most recent call last) ~/Scaricati/SML_CV-master/chignolin_example/svm_chignolin.py in () 118 clr_plt = sns.colorpalette("colorblind") 119 plot(clf.coef.T,marker='o',c=clr_plt[2]) --> 120 vlines(14,-.15,0.15,linestyles='dashed') 121 vlines(50,-.15,0.15,linestyles='dashed') 122 ylim([-.15,0.15])

/opt/python/3/lib/python3.6/site-packages/matplotlib/pyplot.py in vlines(x, ymin, ymax, colors, linestyles, label, hold, data, kwargs) 3652 try: 3653 ret = ax.vlines(x, ymin, ymax, colors=colors, linestyles=linestyles, -> 3654 label=label, data=data, kwargs) 3655 finally: 3656 ax._hold = washold

/opt/python/3/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, *args, *kwargs) 1708 warnings.warn(msg % (label_namer, func.name), 1709 RuntimeWarning, stacklevel=2) -> 1710 return func(ax, args, **kwargs) 1711 pre_doc = inner.doc 1712 if pre_doc is None:

/opt/python/3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in vlines(self, x, ymin, ymax, colors, linestyles, label, **kwargs) 1060 #print 'creating line collection' 1061 lines = mcoll.LineCollection(verts, colors=colors, -> 1062 linestyles=linestyles, label=label) 1063 self.add_collection(lines, autolim=False) 1064 lines.update(kwargs)

/opt/python/3/lib/python3.6/site-packages/matplotlib/collections.py in init(self, segments, linewidths, colors, antialiaseds, linestyles, offsets, transOffset, norm, cmap, pickradius, zorder, facecolors, **kwargs) 1162 antialiaseds = (mpl.rcParams['lines.antialiased'],) 1163 -> 1164 colors = mcolors.to_rgba_array(colors) 1165 1166 Collection.init(

/opt/python/3/lib/python3.6/site-packages/matplotlib/colors.py in to_rgba_array(c, alpha) 206 # array has the wrong kind or shape, raise the error during one-at-a-time 207 # conversion.) --> 208 if (isinstance(c, tuple(np.ndarray)) and c.dtype.kind in "if" 209 and c.ndim == 2 and c.shape[1] in [3, 4]): 210 if c.shape[1] == 3:

TypeError: 'type' object is not iterable"

Can you help to solve this?

Thank you!

msultan commented 5 years ago

hmm, can you try the following:

1). print out clf.coef_.T to see that there are a list of coefficient values there.

2). print out clr_plt to see that there are a list of styles there.

3). Try comment out the vlines to see if the error goes away.

This is a strange bug, and might be because matplotlib changed something in its APIs.

roadhouse23 commented 5 years ago

Ok I solved by updating the matplotlib considering the latest version (2.2.2).

Thank you

Il giorno gio 9 ago 2018 alle ore 16:22 msultan notifications@github.com ha scritto:

hmm, can you try the following:

1). print out clf.coef_.T to see that there are a list of coefficient values there.

2). print out clr_plt to see that there are a list of styles there.

3). Try comment out the vlines to see if the error goes away.

This is a strange bug, and might be because matplotlib changed something in its APIs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/msultan/SML_CV/issues/2#issuecomment-411775207, or mute the thread https://github.com/notifications/unsubscribe-auth/AoQpz9JzYf4qKCa-MzHM9fKkGHnupUs6ks5uPEWUgaJpZM4V1ye- .

msultan commented 5 years ago

closing now.