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

error in chignolin_example #2

Closed
roadhouse23 opened this issue Aug 9, 2018 · 3 comments
Closed

error in chignolin_example #2

roadhouse23 opened this issue Aug 9, 2018 · 3 comments

Comments

@roadhouse23
Copy link

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.color_palette("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
Copy link
Owner

msultan commented Aug 9, 2018

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
Copy link
Author

roadhouse23 commented Aug 9, 2018 via email

@msultan
Copy link
Owner

msultan commented Aug 9, 2018

closing now.

@msultan msultan closed this as completed Aug 9, 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

2 participants