In [1]:
#!pip install seaborn
In [2]:
# Basic Scatter Plot
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
sns.scatterplot(x="total_bill", y="tip", data=tips)
plt.show()
In [3]:
# Customizing the Scatter Plot
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
sns.scatterplot(x="total_bill", y="tip", hue="day", data=tips, palette="Set2")
plt.xlabel(''''Total Bill'''')
plt.ylabel(''''Tip'''')
plt.title(''''Scatter Plot of Total Bill vs. Tip by Day'''')
plt.show()
In [4]:
# Adding Size and Style to the Scatter Plot
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
sns.scatterplot(x="total_bill", y="tip", hue="day", size="size", style="time", data=tips, palette="Set2", sizes=(20, 200))
plt.xlabel(''''Total Bill'''')
plt.ylabel(''''Tip'''')
plt.title(''''Scatter Plot of Total Bill vs. Tip by Day, Size, and Time'''')
plt.show()