Seaborn Scatterplot Method

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
df_tips=sns.load_dataset('tips')
print(df_tips.info())
plt.figure(figsize=(15,10))
sns.scatterplot(x="total_bill",y="tip",hue='time',style='smoker',data=df_tips)
plt.title("Scatter plot of Bill vs Tip")
plt.xlabel("Total Bill")
plt.ylabel("Tip")
plt.show()

Program 2

Seaborn Dataset

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
df_titanic=sns.load_dataset('titanic')

#sns.scatterplot(x='age',y='fare',data=df_titanic)

#sns.scatterplot(x='age',y='fare',data=df_titanic,hue='sex')
#sns.scatterplot(x='age',y='fare',data=df_titanic,hue='sex',style='who')
# sns.scatterplot(x='age',y='fare',data=df_titanic,hue='sex',style='who',size='who',sizes=(100,500))
# plt.title("Scatter plot of Age vs Fare")
# plt.xlabel("Age")
# plt.ylabel("Fare")
# plt.show()
#print(df_df_titanic.info())
#print(df_df_titanic.isnull().sum())

sns.scatterplot(x='age',y='pclass',data=df_titanic)
plt.title("Scatter plot of Age vs Class")
plt.xlabel("Age")
plt.ylabel("Class")
plt.show()

 

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *