我怎样才能改变图例的位置

我怎样才能改变图例的位置

我想改变图例的位置,通过将其放在图形(c)和(d)的下方和中间来修改当前位置。

    \begin{figure}
\begin{tikzpicture}
    \begin{groupplot}[group style={group size= 2 by 2},height=5cm,width=6cm, xmin=0, xmax=2, ymin = 0, ymax = 1]
        \nextgroupplot[ylabel={$W_{cut}$},legend to name=zelda]
                \addplot[color=black, solid, line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_a.txt};
                \addplot[color=red, dashed,  line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_a_Darcy.txt};
                \legend{Brinkman,Darcy}
                \coordinate (top) at (rel axis cs:0,1);           
        \nextgroupplot[]
                \addplot[color=black, solid, line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_b.txt};
                \addplot[color=red, dashed,  line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_b_Darcy.txt};
        \nextgroupplot[xlabel={$t_{D}$},ylabel={$W_{cut}$}]
                \addplot[color=black, solid, line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_c.txt};
                \addplot[color=red, dashed,  line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_c_Darcy.txt};
        \nextgroupplot[xlabel={$t_{D}$}]
                \addplot[color=black, solid, line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_d.txt};
                \addplot[color=red, dashed,  line width=1pt]
                table [col sep=space]
                {graphs/Fig_Qw_tD_Brinkman_Darcy/Qw_tD_sample_d_Darcy.txt};
                \coordinate (bot) at (rel axis cs:1,0);% coordinate at bottom of the last plot
                
    \end{groupplot}
    \node at (0.5,3)  {(a)};
    \node at (6,3)  {(b)};
    \node at (0.5,-1.5) {(c)};
    \node at (6,-1.5) {(d)};
    \path (top)--(bot) coordinate[midway] (group center);
   \node[right=1em,inner sep=0pt] at(group center -| current bounding box.west) {\pgfplotslegendfromname{zelda}};
   
   
\end{tikzpicture}

    \caption{Comparative analysis of Brinkman's model and Darcy's model for samples (a), (b), (c), and (d) using the values of $K_{\Omega_{V}}$ from the table (\ref{tab:4-1}). It is investigated the influence of the dimensionless porous volume injection ($t_{D}$) on the water cut ($W_{cut}$).}
    \label{Brinkman_Darcy_Wcut}

\end{figure}

相关内容