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

ValueError: Invalid RGBA argument: masked #1

Open
Lekhan02 opened this issue Nov 12, 2019 · 0 comments
Open

ValueError: Invalid RGBA argument: masked #1

Lekhan02 opened this issue Nov 12, 2019 · 0 comments

Comments

@Lekhan02
Copy link

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import *
import seaborn as sns
import matplotlib.pyplot as plt

def regression_model(model, df1,df2, name):
x=df1=[["month","year","laptop","mobile"]]
y=df1=[["revenue"]]
model.fit(x,y)
x_test=df2=[["month","year","laptop","mobile"]]
y_test=df2=[["revenue"]]
prediction=model.predict(x_test)
accuracy=model.score(x_test,y_test)
print ('Accuracy : %s' % '{0:.3%}'.format(accuracy), name)
newarray=x_test[["month"]].values
newarray2=newarray.ravel()
newarray3=x_test[["year"]].values
newarray4=newarray3.ravel()
newarray5=predictions.ravel()
newdf = pd.DataFrame({'revenue':newarray5, 'month':newarray2, 'year':newarray4})
sns.factorplot(x="month", y="revenue", hue="year", data=newdf)
plt.show()

data=pd.read_csv("D:/mlsalesdata/testing.csv")
df=pd.DataFrame(data)
df = pd.DataFrame(data)
x = df[['month','year','laptop','mobile']]
y = df[['revenue']]
sns.factorplot(x="month",y="revenue",hue="year",data=df)


ValueError Traceback (most recent call last)
in
----> 1 sns.factorplot(x="month",y="revenue",hue="year",data=df)

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in factorplot(*args, **kwargs)
3674 kwargs.setdefault("kind", "point")
3675
-> 3676 return catplot(*args, **kwargs)
3677
3678

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
3753
3754 # Draw the plot onto the facets
-> 3755 g.map_dataframe(plot_func, x, y, hue, **plot_kws)
3756
3757 # Special case axis labels for a count type plot

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\axisgrid.py in map_dataframe(self, func, *args, **kwargs)
818
819 # Draw the plot
--> 820 self._facet_plot(func, ax, args, kwargs)
821
822 # Finalize the annotations and layout

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
836
837 # Draw the plot
--> 838 func(*plot_args, **plot_kwargs)
839
840 # Sort out the supporting information

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in pointplot(x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, markers, linestyles, dodge, join, scale, orient, color, palette, errwidth, capsize, ax, **kwargs)
3338 ax = plt.gca()
3339
-> 3340 plotter.plot(ax)
3341 return ax
3342

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in plot(self, ax)
1809 def plot(self, ax):
1810 """Make the plot."""
-> 1811 self.draw_points(ax)
1812 self.annotate_axes(ax)
1813 if self.orient == "h":

C:\ProgramData\Anaconda3\lib\site-packages\seaborn\categorical.py in draw_points(self, ax)
1805 c=point_colors, edgecolor=point_colors,
1806 linewidth=mew, marker=marker, s=markersize,
-> 1807 zorder=z)
1808
1809 def plot(self, ax):

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib_init_.py in inner(ax, data, *args, **kwargs)
1587 def inner(ax, *args, data=None, **kwargs):
1588 if data is None:
-> 1589 return func(ax, *map(sanitize_sequence, args), **kwargs)
1590
1591 bound = new_sig.bind(ax, *args, **kwargs)

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)
4488 offsets=offsets,
4489 transOffset=kwargs.pop('transform', self.transData),
-> 4490 alpha=alpha
4491 )
4492 collection.set_transform(mtransforms.IdentityTransform())

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in init(self, paths, sizes, **kwargs)
881 """
882
--> 883 Collection.init(self, **kwargs)
884 self.set_paths(paths)
885 self.set_sizes(sizes)

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)
126 self._hatch_color = mcolors.to_rgba(mpl.rcParams['hatch.color'])
127 self.set_facecolor(facecolors)
--> 128 self.set_edgecolor(edgecolors)
129 self.set_linewidth(linewidths)
130 self.set_linestyle(linestyles)

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in set_edgecolor(self, c)
726 """
727 self._original_edgecolor = c
--> 728 self._set_edgecolor(c)
729
730 def set_alpha(self, alpha):

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\collections.py in _set_edgecolor(self, c)
710 except AttributeError:
711 pass
--> 712 self._edgecolors = mcolors.to_rgba_array(c, self._alpha)
713 if set_hatch_color and len(self._edgecolors):
714 self._hatch_color = tuple(self._edgecolors[0])

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba_array(c, alpha)
284 result = np.empty((len(c), 4), float)
285 for i, cc in enumerate(c):
--> 286 result[i] = to_rgba(cc, alpha)
287 return result
288

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
175 rgba = None
176 if rgba is None: # Suppress exception chaining of cache lookup failure.
--> 177 rgba = _to_rgba_no_colorcycle(c, alpha)
178 try:
179 _colors_full_map.cache[c, alpha] = rgba

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)
236 # float)andnp.array(...).astype(float)` all convert "0.5" to 0.5.
237 # Test dimensionality to reject single floats.
--> 238 raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
239 # Return a tuple to prevent the cached value from being modified.
240 c = tuple(c.astype(float))

ValueError: Invalid RGBA argument: masked

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