-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualization.py
More file actions
34 lines (30 loc) · 1.02 KB
/
visualization.py
File metadata and controls
34 lines (30 loc) · 1.02 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
import matplotlib.pyplot as plt
import seaborn as sns
def generate_histogram(df, column_name):
plt.figure(figsize=(8, 6))
sns.histplot(data=df, x=column_name, bins=20, kde=True)
plt.title(f"Histogram of {column_name}")
plt.xlabel(column_name)
plt.ylabel("Frequency")
plt.show()
def generate_box_plot(df, numerical_columns):
plt.figure(figsize=(10, 6))
sns.boxplot(data=df[numerical_columns])
plt.title(f"Box Plot of numerical_columns")
plt.ylabel(numerical_columns.all())
plt.show()
def generate_scatter_plot(df, x_column, y_column):
plt.figure(figsize=(8, 6))
sns.scatterplot(data=df, x=x_column, y=y_column)
plt.title(f"Scatter Plot of {x_column} vs {y_column}")
plt.xlabel(x_column)
plt.ylabel(y_column)
plt.show()
def generate_bar_plot(df, column_name):
plt.figure(figsize=(8, 6))
sns.countplot(data=df, x=column_name)
plt.title(f"Bar Plot of {column_name}")
plt.xlabel(column_name)
plt.ylabel("Count")
plt.xticks(rotation=45)
plt.show()