Last answered:

14 Nov 2024

Posted on:

13 Nov 2024

0

How to change the color of a scatter without a third variable in Python with Seaborn?

Doing the homework and just wondering if you can/how to change the default color of the scatter plot in Python using the "sns.scatterplot()" way. 
1 answers ( 0 marked as helpful)
Instructor
Posted on:

14 Nov 2024

0
Hi!
To change the default color of a scatter plot in Seaborn (sns.scatterplot), you can specify the color parameter. Here's an example. Hope this helps!
import seaborn as sns
import matplotlib.pyplot as plt

# Sample data
data = sns.load_dataset("iris")

# Scatter plot with custom color
sns.scatterplot(data=data, x="sepal_length", y="sepal_width", color="purple")

plt.show()

Submit an answer