File size: 851 Bytes
c61c393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Plotting for contradiction results."""
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt


def plot_position_dominance(dominance: Dict[str, float], title: str, save_path: str):
    """Bar chart showing which position wins when contradictions exist."""
    positions = list(dominance.keys())
    values = [dominance[p] for p in positions]
    colors = {"start": "#2E86AB", "middle": "#E63946", "end": "#2E86AB", "other": "#A8DADC"}
    bar_colors = [colors.get(p, "#A8DADC") for p in positions]

    plt.figure(figsize=(7, 5))
    plt.bar(positions, values, color=bar_colors, edgecolor="black", linewidth=1.2)
    plt.ylabel("Selection Rate", fontsize=13)
    plt.title(title, fontsize=13)
    plt.ylim(0, 1.05)
    plt.grid(True, alpha=0.3, axis="y")
    plt.tight_layout()
    plt.savefig(save_path, dpi=200)
    plt.close()