-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDistribution_Plots.py
More file actions
50 lines (35 loc) · 1.18 KB
/
Copy pathDistribution_Plots.py
File metadata and controls
50 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Distributions
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset('tips')
# Create a histogram with KDE for the 'total_bill' column
sns.histplot(tips['total_bill'], kde=True, color='blue')
# Adjust layout to prevent the title from being cut off
plt.tight_layout()
# Add title and labels
plt.title('Distribution of Total Bill Amounts')
plt.xlabel('Total Bill ($)')
plt.ylabel('Frequency')
plt.show()
# Create a scatter plot with a regression line
sns.lmplot(x='total_bill', y='tip', data=tips)
# Add title
plt.title('Relationship Between Total Bill and Tip')
plt.show()
# Create a box plot to compare tips across different days
sns.boxplot(x='day', y='tip', data=tips)
# Add title
plt.title('Tip Amounts by Day of the Week')
plt.xlabel('Day of the Week')
plt.ylabel('Tip Amount ($)')
plt.show()
# Creating a violin plot to visualize the distribution of tips by day of the week
sns.violinplot(x='day', y='tip', data=tips, inner='quartile', palette='coolwarm')
# Add title and labels
plt.title('Distribution of Tip Amounts by Day of the Week')
plt.xlabel('Day of the Week')
plt.ylabel('Tip Amount ($)')
# Adjust layout
plt.tight_layout()
# Display the plot
plt.show()