Reputation: 169
I would like to add to the plot below open circles surrounding each data point and set the diameter proportional to the values of a 3rd variable. Currently, this is what I tried but the circles are filled and cover the data points. Using "facecolors='none'" did not help.
z = df.z # this is the 3rd variable
s = [10*2**n for n in range(len(z))]
ax1 = sns.scatterplot(x='LEF', y='NPQ', hue="Regime", markers=["o",
"^"], s=s, facecolors='none', data=df, ax=ax1)
Upvotes: 0
Views: 415
Reputation: 80279
The following approach loops through the generated dots, and sets their edgecolors to their facecolors. Then the facecolors are set to fully transparent.
import matplotlib.pyplot as plt
import seaborn as sns
tips = sns.load_dataset('tips')
ax = sns.scatterplot(data=tips, x="total_bill", y="tip", hue="day", size="size", sizes=(10, 200))
for dots in ax.collections:
facecolors = dots.get_facecolors()
dots.set_edgecolors(facecolors.copy())
dots.set_facecolors('none')
dots.set_linewidth(2)
plt.show()
Upvotes: 1