import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Load the data into a DataFrame
data = pd.read_csv("supply_chain_data.csv")
# Correlation matrix
plt.figure(figsize=(10, 8))
sns.heatmap(data.corr(numeric_only=True), annot=True, cmap="coolwarm", fmt=".1f")
plt.title("Correlation Matrix")
plt.show()
# Histogram of product prices
plt.figure(figsize=(8, 6))
ax = sns.histplot(data["Price"], bins=20, kde=True)
plt.title("Distribution of Product Prices")
plt.xlabel("Price")
plt.ylabel("Count")
# Annotate Histogram bars with their counts
for rect in ax.patches:
height = rect.get_height()
ax.annotate(f'{int(height)}', xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, -20), textcoords='offset points', ha='center', va='bottom')
plt.show()
# Bar chart of product categories
plt.figure(figsize=(10, 6))
ax = data["Product type"].value_counts().plot(kind="bar")
plt.title("Number of Products by Category")
plt.xlabel("Product Category")
plt.ylabel("Count")
# Annotate bars with their counts
for rect in ax.patches:
height = rect.get_height()
ax.annotate(f'{int(height)}', xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, -20), textcoords='offset points', ha='center', va='bottom')
plt.show()