seaborn画图出错
使用seaborn画图的时候出错了,但是不知道是那里的问题fig = sns.catplot(data=data, x='SPE', y='Acceptance.RESP'
,kind='point'
,hue='evaluation'
#,col_wrap=3
,estimator=np.mean
,ci=None
)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_51344/1292113035.py in <module>
1 # 单个被试
----> 2 fig = sns.catplot(data=data, x='SPE', y='Acceptance.RESP'
3 ,kind='point'
4 ,hue='evaluation'
5 #,col_wrap=3
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\_decorators.py in inner_f(*args, **kwargs)
44 )
45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46 return f(**kwargs)
47 return inner_f
48
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, seed, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
3845
3846 # Draw the plot onto the facets
-> 3847 g.map_dataframe(plot_func, x=x, y=y, hue=hue, **plot_kws)
3848
3849 if p.orient == "h":
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\axisgrid.py in map_dataframe(self, func, *args, **kwargs)
775
776 # Draw the plot
--> 777 self._facet_plot(func, ax, args, kwargs)
778
779 # For axis labels, prefer to use positional args for backcompat
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
804 plot_args = []
805 plot_kwargs["ax"] = ax
--> 806 func(*plot_args, **plot_kwargs)
807
808 # Sort out the supporting information
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\_decorators.py in inner_f(*args, **kwargs)
44 )
45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46 return f(**kwargs)
47 return inner_f
48
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in pointplot(x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, seed, markers, linestyles, dodge, join, scale, orient, color, palette, errwidth, capsize, ax, **kwargs)
3381 ax = plt.gca()
3382
-> 3383 plotter.plot(ax)
3384 return ax
3385
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in plot(self, ax)
1786 def plot(self, ax):
1787 """Make the plot."""
-> 1788 self.draw_points(ax)
1789 self.annotate_axes(ax)
1790 if self.orient == "h":
C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in draw_points(self, ax)
1779 x = y = * n_points
1780
-> 1781 ax.scatter(x, y, label=hue_level,
1782 facecolor=color, edgecolor=color,
1783 linewidth=mew, marker=marker, s=markersize,
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs)
1445 def inner(ax, *args, data=None, **kwargs):
1446 if data is None:
-> 1447 return func(ax, *map(sanitize_sequence, args), **kwargs)
1448
1449 bound = new_sig.bind(ax, *args, **kwargs)
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py in wrapper(*inner_args, **inner_kwargs)
409 else deprecation_addendum,
410 **kwargs)
--> 411 return func(*inner_args, **inner_kwargs)
412
413 return wrapper
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, plotnonfinite, **kwargs)
4486 offsets = np.ma.column_stack()
4487
-> 4488 collection = mcoll.PathCollection(
4489 (path,), scales,
4490 facecolors=colors,
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in __init__(self, paths, sizes, **kwargs)
951 """
952
--> 953 super().__init__(**kwargs)
954 self.set_paths(paths)
955 self.set_sizes(sizes)
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py in wrapper(*inner_args, **inner_kwargs)
409 else deprecation_addendum,
410 **kwargs)
--> 411 return func(*inner_args, **inner_kwargs)
412
413 return wrapper
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in __init__(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, transOffset, norm, cmap, pickradius, hatch, urls, offset_position, zorder, **kwargs)
173 self._hatch_color = mcolors.to_rgba(mpl.rcParams['hatch.color'])
174 self.set_facecolor(facecolors)
--> 175 self.set_edgecolor(edgecolors)
176 self.set_linewidth(linewidths)
177 self.set_linestyle(linestyles)
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in set_edgecolor(self, c)
828 """
829 self._original_edgecolor = c
--> 830 self._set_edgecolor(c)
831
832 def set_alpha(self, alpha):
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in _set_edgecolor(self, c)
812 except AttributeError:
813 pass
--> 814 self._edgecolors = mcolors.to_rgba_array(c, self._alpha)
815 if set_hatch_color and len(self._edgecolors):
816 self._hatch_color = tuple(self._edgecolors)
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba_array(c, alpha)
339 return np.zeros((0, 4), float)
340 else:
--> 341 return np.array()
342
343
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in <listcomp>(.0)
339 return np.zeros((0, 4), float)
340 else:
--> 341 return np.array()
342
343
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
187 rgba = None
188 if rgba is None:# Suppress exception chaining of cache lookup failure.
--> 189 rgba = _to_rgba_no_colorcycle(c, alpha)
190 try:
191 _colors_full_map.cache = rgba
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)
261 # tuple color.
262 if not np.iterable(c):
--> 263 raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
264 if len(c) not in :
265 raise ValueError("RGBA sequence should have length 3 or 4")
ValueError: Invalid RGBA argument: 0.12156862745098039 evaluation这一列数据是int(0)或者int(1)
页:
[1]