mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: Extract color assignment logic into a separate function
This commit is contained in:
parent
04e816ff2e
commit
5ccdebf2c0
1 changed files with 12 additions and 8 deletions
|
@ -6,6 +6,17 @@ from matplotlib import rc
|
||||||
from aider.dump import dump # noqa: 401
|
from aider.dump import dump # noqa: 401
|
||||||
|
|
||||||
|
|
||||||
|
def get_model_color(model):
|
||||||
|
if "-4o" in model and "gpt-4o-mini" not in model:
|
||||||
|
return "purple"
|
||||||
|
elif "gpt-4" in model:
|
||||||
|
return "red"
|
||||||
|
elif "gpt-3.5" in model:
|
||||||
|
return "green"
|
||||||
|
else:
|
||||||
|
return "lightblue"
|
||||||
|
|
||||||
|
|
||||||
def plot_over_time(yaml_file):
|
def plot_over_time(yaml_file):
|
||||||
with open(yaml_file, "r") as file:
|
with open(yaml_file, "r") as file:
|
||||||
data = yaml.safe_load(file)
|
data = yaml.safe_load(file)
|
||||||
|
@ -49,14 +60,7 @@ def plot_over_time(yaml_file):
|
||||||
spine.set_edgecolor("#DDDDDD")
|
spine.set_edgecolor("#DDDDDD")
|
||||||
spine.set_linewidth(0.5)
|
spine.set_linewidth(0.5)
|
||||||
|
|
||||||
colors = [
|
colors = [get_model_color(model) for model in models]
|
||||||
(
|
|
||||||
"purple"
|
|
||||||
if "-4o" in model and "gpt-4o-mini" not in model
|
|
||||||
else "red" if "gpt-4" in model else "green" if "gpt-3.5" in model else "lightblue"
|
|
||||||
)
|
|
||||||
for model in models
|
|
||||||
]
|
|
||||||
|
|
||||||
# Separate data points by color
|
# Separate data points by color
|
||||||
purple_points = [(d, r) for d, r, c in zip(dates, pass_rates, colors) if c == "purple"]
|
purple_points = [(d, r) for d, r, c in zip(dates, pass_rates, colors) if c == "purple"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue