I am trying to output a complex facet grid plot in the format of the following image:

enter image description here

But the problem is that I don't want the edge color of the markers to be white, I want it to be the face color.

In matplotlib, I can change the color of marker edges by calling the following:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.DataFrame({"values_x": np.random.randn(100), "values_y": np.random.randn(100)})

plt.scatter(x=df["values_x"], y=df["values_y"], edgecolors="red")

This produces a plot that looks like:

enter image description here

Now, if I call the following:

sns.relplot(data=df, x="values_x", y="values_y", edgecolors="red")

I still get white marker edges like in the following:

enter image description here

So, how do I correctly change the color of the marker edges within a call to sns.relplot()?

*For reference, I create the top facet grid plot with the following:

  • $\begingroup$ Remove $edgecolors="red"$ and it will give you the desired plot. $\endgroup$ – Fatemeh Asgarinejad Aug 7 '19 at 20:07
  • $\begingroup$ If I remove that I still get white edges around the markers. I want the edges to be whatever color I choose them to be. I actually figured out the problem and will update the question. $\endgroup$ – Russell Gould Aug 7 '19 at 20:20
  • $\begingroup$ That's weird. I didn't get that white marks. $\endgroup$ – Fatemeh Asgarinejad Aug 8 '19 at 1:07

The issue was with the parameter I was using. The parameter "edgecolors" is incorrect. The correct parameter is the non-plural "edgecolor". So the correct call to relplot is:

sns.relplot(data=df, x="values_x", y="values_y", edgecolor=None)

This would remove the marker edges completely, which is what I was trying to do originally.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.