% SWE-bench Lite comparison: Harness vs Claude Code (both Sonnet 4.6)
% Requires: \usepackage{pgfplots}
% Requires: \pgfplotsset{compat=1.18}
\begin{tikzpicture}

% --- Left: Bar chart for patches & median sizes ---
\begin{axis}[
    name=bars,
    ybar,
    width=6.5cm,
    height=6cm,
    bar width=16pt,
    enlarge x limits=0.35,
    ymin=0,
    ymax=70,
    ylabel={Count / Lines},
    ylabel style={font=\small},
    symbolic x coords={Patches, Median Lines},
    xtick=data,
    xticklabel style={font=\small},
    yticklabel style={font=\small},
    legend style={
        at={(0.5, 1.03)},
        anchor=south,
        legend columns=2,
        font=\small,
        draw=black!30,
    },
    nodes near coords,
    every node near coord/.append style={font=\footnotesize, yshift=2pt},
    grid=major,
    grid style={gray!20},
    axis lines*=left,
    title={Patch Statistics},
    title style={font=\small\bfseries},
]

% Harness bars
\addplot[fill=blue!55, draw=blue!70] coordinates {
    (Patches, 24)
    (Median Lines, 58)
};

% Claude Code bars
\addplot[fill=gray!45, draw=gray!60] coordinates {
    (Patches, 24)
    (Median Lines, 44)
};

\legend{Harness, Claude Code}

\end{axis}

% Annotation: both fail django-11797
\node[below=0.4cm of bars.south, font=\scriptsize, text=gray!70!black,
      text width=5.5cm, align=center]
    {Both agents produce 24/25 patches\\(both fail \texttt{django-11797})};

% --- Right: Scatter plot per task ---
\begin{axis}[
    at={(bars.east)},
    anchor=west,
    xshift=2.0cm,
    width=6.5cm,
    height=6cm,
    xlabel={Harness patch size (lines)},
    ylabel={Claude Code patch size (lines)},
    xlabel style={font=\small},
    ylabel style={font=\small},
    xticklabel style={font=\small},
    yticklabel style={font=\small},
    xmin=0, xmax=250,
    ymin=0, ymax=250,
    grid=major,
    grid style={gray!15},
    axis lines*=left,
    title={Per-Task Patch Sizes},
    title style={font=\small\bfseries},
    clip=false,
]

% Diagonal reference line (y=x)
\addplot[domain=0:250, samples=2, gray!50, dashed, thin] {x};
\node[font=\tiny, text=gray!50, rotate=45] at (axis cs:210,225) {$y{=}x$};

% Real per-task data from SWE-bench Lite comparison
% (x=Harness lines, y=Claude Code lines)
\addplot[
    only marks,
    mark=*,
    mark size=2pt,
    blue!60,
] coordinates {
    (48, 44)    % astropy-12907
    (110, 64)   % astropy-14182
    (31, 13)    % astropy-14365
    (52, 13)    % astropy-14995
    (54, 43)    % astropy-6938
    (90, 27)    % astropy-7746
    (44, 56)    % django-10914
    (92, 67)    % django-10924
    (62, 41)    % django-11001
    (188, 128)  % django-11019
    (42, 42)    % django-11039
    (39, 26)    % django-11049
    (44, 22)    % django-11099
    (42, 13)    % django-11133
    (31, 12)    % django-11179
    (156, 90)   % django-11283
    (50, 48)    % django-11422
    (232, 122)  % django-11564
    (28, 13)    % django-11583
    (69, 56)    % django-11620
    (147, 79)   % django-11630
    (146, 77)   % django-11742
    (76, 76)    % django-11815
    (62, 20)    % django-11848
};

% Median crosshairs
\draw[blue!50, densely dotted, thin] (axis cs:58,0) -- (axis cs:58,250)
    node[pos=0.92, right, font=\tiny, text=blue!60] {med.=58};
\draw[gray!60, densely dotted, thin] (axis cs:0,44) -- (axis cs:250,44)
    node[pos=0.05, above, font=\tiny, text=gray!60] {med.=44};

\end{axis}

\end{tikzpicture}
