-
Maxime MORGE authored559b042e
investment_draw.py 1.15 KiB
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Custom color palette
color_palette = {
'random': '#333333', #
'gpt-4.5-preview-2025-02-27': '#7abaff', # Blue
'llama3': '#32a68c', # Green
'mistral-small': '#ff6941', # Orange
'deepseek-r1': '#5862ed' # Indigo
}
# Load CSV file
file_path = "../../data/investment/investment.csv" # Update path
df = pd.read_csv(file_path)
# Clean column names
df.columns = df.columns.str.strip()
# Ensure required columns exist
if "ccei" not in df.columns or "model" not in df.columns:
raise ValueError("Missing required columns ('ccei' or 'model') in the dataset!")
# Set Seaborn style
sns.set(style="whitegrid")
# Create figure
plt.figure(figsize=(10, 6))
# Draw boxplot
sns.boxplot(data=df, x="model", y="ccei", palette=color_palette, width=0.6)
# Add plot labels
plt.title("CCEI Distribution by Model", fontsize=14)
plt.xlabel("Model", fontsize=12)
plt.ylabel("CCEI Value", fontsize=12)
# Rotate x-axis labels for better readability
plt.xticks(rotation=20)
# Save the figure
output_path = ("../../figures/investment/investment.svg")
plt.savefig(output_path, format="svg")