I am using seaborn's stripplot and pointplot to plot my data (Reference)
My code is:
sns.set_palette("Purples")
sns.stripplot(
data=df_d_pt, x="feat", y="acc", hue="alpha",
dodge=True, alpha=.2, legend=False,
)
sns.pointplot(
data=df_d_pt, x="feat", y="acc", hue="alpha",
dodge=.4, linestyle="none", errorbar=None,
marker="_", markersize=10, markeredgewidth=3,
)
However it seems legend=False is not working as I get the error:
---------------------------------------------------------------------------
AttributeError
Traceback (most recent call last) <ipython-input-156-18efd4be2baa> in <module>
3 sns.stripplot(
4 data=df_d_pt, x="feat", y="acc", hue="alpha",
----> 5 dodge=True, alpha=.2, legend=False,
6 )
7
~/.local/lib/python3.6/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
~/.local/lib/python3.6/site-packages/seaborn/categorical.py in stripplot(x, y, hue, data, order, hue_order, jitter, dodge, orient, color, palette, size, edgecolor, linewidth, ax, **kwargs) 2820 linewidth=linewidth)) 2821
-> 2822 plotter.plot(ax, kwargs) 2823 return ax 2824
~/.local/lib/python3.6/site-packages/seaborn/categorical.py in plot(self, ax, kws) 1158 def plot(self, ax, kws): 1159 """Make the plot."""
-> 1160 self.draw_stripplot(ax, kws) 1161 self.add_legend_data(ax) 1162 self.annotate_axes(ax)
~/.local/lib/python3.6/site-packages/seaborn/categorical.py in draw_stripplot(self, ax, kws) 1152 kws.update(c=palette[point_colors]) 1153 if self.orient == "v":
-> 1154 ax.scatter(cat_pos, strip_data, **kws) 1155 else: 1156 ax.scatter(strip_data, cat_pos, **kws)
/opt/conda/lib/python3.6/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)
/opt/conda/lib/python3.6/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
/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, plotnonfinite, **kwargs) 4496 ) 4497 collection.set_transform(mtransforms.IdentityTransform())
-> 4498 collection.update(kwargs) 4499 4500 if colors is None:
/opt/conda/lib/python3.6/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: 'PathCollection' object has no property 'legend'
If I remove the "legend=False" from my code, results will look like this:
How can I solve this problem? Either remove the legend or put it on the right side of my figure

You can use
to remove the legend.
You can use
to move legend to the right side of the plot (outside of plot)