17 lines
454 B
Python
17 lines
454 B
Python
import matplotlib.pyplot as plt
|
|
import seaborn as sns
|
|
|
|
def plot_histogram(data, column):
|
|
fig, ax = plt.subplots()
|
|
ax.hist(data[column].dropna(), bins=20, edgecolor='k')
|
|
ax.set_title(f"Histogram of {column}")
|
|
ax.set_xlabel(column)
|
|
ax.set_ylabel("Frequency")
|
|
return fig
|
|
|
|
def plot_boxplot(data, column):
|
|
fig, ax = plt.subplots()
|
|
sns.boxplot(data=data, x=column, ax=ax)
|
|
ax.set_title(f"Boxplot of {column}")
|
|
return fig
|