\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    width=12cm,
    height=8cm,
    %xlabel={Error Magnitude (m)},
    ylabel={Reward Value},
    xmin=0, xmax=3,
    ymin=0, ymax=1.0,
    grid=major,
    grid style={dashed,gray!30},
    legend pos=north east,
    legend style={fill=white, fill opacity=0.8, draw=black, text opacity=1},
    title={Comparison of Reward Functions},
    title style={font=\bfseries},
    thick,
    name=plot1
]

% Linear Reward: R = 1.0 * (1 - e/5.0)
\addplot[
    domain=0:3,
    samples=100,
    color=blue,
    line width=1.5pt
] {1.0 * (1 - x/3.0)};
\addlegendentry{Linear Reward}

% Exponential Reward: R = 1.0 * exp(-3.0 * e)
\addplot[
    domain=0:3,
    samples=100,
    color=red,
    line width=1.5pt
] {1.0 * exp(-3.0 * x)};
\addlegendentry{Exponential Reward}

\end{axis}

\begin{axis}[
    width=12cm,
    height=8cm,
    xlabel={Error Magnitude},
    ylabel={Reward Value},
    xmin=0, xmax=3,
    ymin=-9.0, ymax=0.5,
    grid=major,
    grid style={dashed,gray!30},
    legend pos=north east,
    legend style={fill=white, fill opacity=0.8,
     draw=black, text opacity=1, yshift = -10pt},
    %title={Comparison of Reward Functions},
    title style={font=\bfseries},
    thick,
    at={(plot1.south west)},        % ⬅ position below first
    anchor=north west,               % ⬅ top of this axis touches bottom of first
    yshift=-1.2cm                    % ⬅ optional vertical spacing
]

% PQR: R = -1.0 * e^2 + 0.1
\addplot[
    domain=0:3,
    samples=100,
    color=green!60!black,
    line width=1.5pt
] {-1.0 * x^2 + 0.1};
\addlegendentry{PQR (Quadratic + Progress)}

% Reference line at y=0
\addplot[
    domain=0:3,
    samples=2,
    color=black,
    dashed,
    line width=0.8pt
] {0};

\end{axis}

\end{tikzpicture}
\end{document}