1

I would like to change the position of the legend, modifying the current position by placing it below and centered between the graphic (c) and (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}
2
  • Welcome. // Please try the following: copy your posted code into a new file. Compile it. If it fails, add the missing parts step by step, in a minimalist way. Once it compiles, does it still show your problem? If so : THAT‘s the code we‘d like to see here … Thank you
    – MS-SPO
    May 21 at 3:31
  • See how legend is positioned in tex.stackexchange.com/questions/661028/…
    – Zarko
    May 21 at 5:05

0

You must log in to answer this question.

Browse other questions tagged .