About Lesson
Chalen kuch or plots bnatay hyn
Join the conversation
where we have to send assignments?
Reply
for the correlation heat map this code is working:
import seaborn as sns
import matplotlib.pyplot as pltnumeric_columns = kashti.select_dtypes(include=['float64', 'int64']).columns
corr_matrix = kashti[numeric_columns].corr()plt.figure(figsize=(10, 10))
sns.heatmap(corr_matrix, annot=True)
plt.title('Correlation Heatmap')
plt.show()
Reply
to plot in matplotlib.pyplot we use c
import matplotlib.pyplot as pltplt.scatter(data=kashti, x="age", y="fare", c='pclass')
plt.xlabel('Age')
plt.ylabel('Fare')
plt.title('Scatter Plot of Age vs Fare with Pclass')
plt.show()
Reply
heat map not work
Reply
This will work probably:
numeric_columns = kashti.select_dtypes(include=['float64', 'int64']).columns
corr_matrix = kashti[numeric_columns].corr()plt.figure(figsize=(10, 10))
sns.heatmap(corr_matrix, annot=True)
plt.title('Correlation Heatmap')
plt.show()
@9:38
"color, colour, hue" nahi lgy ga
Yahan "c" lgy ga only
Reply
# Define a color palette (you can choose different colors)
colors = {1: 'blue', 2: 'green', 3: 'red'}# Plot each group
for pclass, group_data in kashti.groupby('pclass'):
plt.scatter(group_data['age'], group_data['fare'], color=colors[pclass], label=f'Class {pclass}')# Add labels and legend
plt.xlabel('Age')
plt.ylabel('Fare')
plt.legend(title='Passenger Class')
# Assignment: How to change the x and y axis titles with main title?boxchart = sns.boxplot(data=kashti, x="sex", y="fare", hue='pclass')
boxchart.set_title('Assignment')
boxchart.set_xlabel('Sex')
boxchart.set_ylabel('Fare')
boxchart
Reply
plt.scatter(data=kashti, x="age", y="fare", c=kashti["pclass"])
Reply
done
Reply
Jio Murshid ji
Reply
Data Visualization on iris and tips datasets : https://github.com/SirajAtFiverr/PKC-2023/blob/main/day_11/data_visualization.ipynb
Reply
Behtareen Siraj Bhai