danielritchie/generative-affect-engine
0
1import matplotlib.pyplot as plt2from utils.presets import EMOTION_PRESETS3 4 5def generate_scatter(raw, cinematic, emotion, drama):6 fig, ax = plt.subplots(figsize=(6, 6))7 8 # Plot target anchors faintly9 for name, preset in EMOTION_PRESETS.items():10 t = preset["target"]11 ax.scatter(t["V"], t["A"], alpha=0.2, s=100, color="gray")12 13 # Raw point14 ax.scatter(raw["V"], raw["A"], s=200, color="blue", label="Raw")15 16 # Cinematic point17 ax.scatter(cinematic["V"], cinematic["A"], s=200, color="red", label="Cinematic")18 19 # Arrow scaled by drama20 ax.arrow(21 raw["V"],22 raw["A"],23 cinematic["V"] - raw["V"],24 cinematic["A"] - raw["A"],25 head_width=0.02,26 length_includes_head=True,27 color="black"28 )29 30 ax.set_xlim(0, 1)31 ax.set_ylim(0, 1)32 ax.set_xlabel("Valence")33 ax.set_ylabel("Arousal")34 ax.set_title(f"{emotion} | Drama: {round(drama,2)}")35 ax.legend()36 37 plt.tight_layout()38 return fig39 40 